jbms / sphinx-immaterial

Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system
https://jbms.github.io/sphinx-immaterial/
Other
177 stars 28 forks source link

"Copy to clipboard" and "Back to top" Buttons Disappear After Adjusting Theme Settings #336

Closed urvantsev closed 3 months ago

urvantsev commented 3 months ago

My goal was to adjust the "palette" settings to use the dark theme exclusively by removing the toggle option. However, after making this adjustment, I've noticed that the "Copy to clipboard" buttons within code blocks and the "Back to top" buttons have disappeared. I don't see any obvious connection between the "palette" adjustments and these buttons, leading me to suspect this may be a bug.

image

On the left, the "palette" was edited to enable only the Dark theme, resulting in the unintended side effect of the "Copy to clipboard" and "Back to top" buttons disappearing. On the right is the "palette" after reverting this change, after that the "Copy to clipboard" and "Back to top" buttons reappeared as expected.

2bndy5 commented 3 months ago

Did you try doing a fresh rebuild (sphinx-build -a) after making the edits?

urvantsev commented 3 months ago

@2bndy5, yes, I've been playing with this quite some time, tried to rebuild from fresh multiple times on different machines (locally and on the server where we host it), same behavior.

2bndy5 commented 3 months ago

I still think there's something you have overlooked. I cannot reproduce using this theme's docs and the changes demonstrated in the OP.

"Copy to clipboard" and "Back to top" buttons

Both of these buttons are implemented in JS, so it could just be the browser you are using.

urvantsev commented 3 months ago

@2bndy5, I confirm that it is browser related. It works in Edge, but doesn't work in Chrome, for example.

2bndy5 commented 3 months ago

Still a bit odd. I think most people use Chrome; I use firefox and boycott edge. Since it is JS at fault here, then one of the extensions you enabled in chrome might be preventing the theme's JS to start properly. Best to press F12 and check the console for error messages.

urvantsev commented 3 months ago

@2bndy5, error message:

image

2bndy5 commented 3 months ago

Sorry, you have to figure that out yourself. At least you have something to start with. My guess is that some browser extension is altering the site's DOM before the theme JS is done loading.

Maybe go through your chrome extensions and disable them one at a time to see if the error goes away. I can't do much for you since the theme works fine in my local install of chrome.

[!NOTE] Enabling sphinx_immaterial_bundle_source_maps should help make the error message more readable.