-
Notifications
You must be signed in to change notification settings - Fork 4
Fix darkmode presentation #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@himorin I suggest we merge this and also merge it into the CR branch as soon as you can approve it, because the current CR version is broken now in dark mode. Actually it's still broken but not quite as badly - the dark mode toggle tries to remember the setting but doesn't re-apply it on page load, you have to explicitly click it to Light or Auto and then back to Dark to get the rest of the page to load properly, but that's a problem with someone else's script - probably fixup.js, I imagine. |
if we want to introduce duplicate CSS definition from prefers-color-scheme to .darkmode, I suppose we should do the same thing for light with default mode as darkmode.. |
I don't think we need to - it's the default behaviour and seems to work fine without doing that. |
@himorin just to add, if you have any reproducible steps that show a problem with the light mode styling not being applied in light mode, please tell me! I tried all the ways I could think of and could not create a problem with the CSS as it is in this PR. In Firefox's dev tools it shows that the |
I wonder what will happen when 1) browser is configured with dark mode as default, 2) user manually select light via left lower selection panel (similar to forced dark mode)... |
Aha! Yes, that does have a problem, I didn't think of setting it at the browser level, before I was just setting it at the OS and the page level. I will add a fix for that. Thank you! |
@himorin I think that's fixed now: are you able to check and confirm? |
Using https://github.com/Cimbali/toggle-dark-mode (very useful to play around with things) I think a lot of spec pages aren't set up to work properly with a mismatch between the page selection and the browser selection. When they match, this works great. |
Thanks for that @gkatsev - did you try toggling the light/dark selector at the bottom of the sidebar back and forth after loading the page? I think there's an issue with the following sequence, which is not something we can fix:
|
I can reproduce that, but it seems to only happen when the browser is in light mode and choosing dark mode on the page toggle. |
It's also worth noting that what that sidebar toggle does is just adds or removes the Having said that, this PR does set the styles based on both the media query and the |
ah, can trigger it also by selecting dark mode and using the extension to toggle the browser darkmode setting. Guess it's a mismatch between respec's |
The full solution likely involves dealing with the media query and the css class and fixing each permutation |
Also fixing the W3C stylesheets to do the same. |
Not only not a blocker for this PR but also not a blocker for CR publication, assuming this PR gets merged. |
Are you able to get this into the CR for tomorrow, @himorin ? |
8df2eb8
to
780db19
Compare
Dark mode somehow got broken in the last 7 months since I last fixed it.
The current toggles don't fix the media query for prefers darkmode, but just add the
darkmode
class to thebody
element. Explicitly set the colours when thedarkmode
class is added tobody
, horribly duplicating the existing@media (prefers-color-scheme: dark)
rule but using CSS nesting.This is a hack but does make all the text at least readable in dark mode.
Preview | Diff