-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Dark Mode Flash Fix #1524
Dark Mode Flash Fix #1524
Conversation
- move dark-mode class to html tag - rearrange head order - add document ready checks - remove script tags from markup
…into dark_flash
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Also added @jonchurch since he opened the original issue. |
I had made it a draft PR to check out that preview as I noted before, so I just made it a normal PR. |
- remove console.log
RE: previous comments about nav bar flicker. I think this is a separate issue #1526. So disregard that. |
This has not fixed the problem :( Is this change pushed to production already? If I look at the preview, the flash is not there, that's why I thought it was fixed. But the flash is there in prod. |
I do see the code changes are in prod. So I guess I need to take another stab at this. I'm not sure why it's not working as expected. I pulled the updated prod changes to my machine and the flash is NOT happening there. So I'm not sure how to debug this since it's only happening on the expressjs.com site, even thought I can see the changes in the markup there. |
Maybe it's a GH pages issue? Whereas the preview is Netlify and not happening there? |
I tried to push my own instance of the site to GH pages and it's not working. It's not inputting the How do you guys get around this when deploying to pages? It's going to take alot of tinkering to get this to run on my own pages if I have to do it all manually |
FYI: Hacked together a working version. |
This fixes issue #1508. Adjust setting of the dark mode class and moved the order of the head to load to run the JS first and add the
dark-mode class
, then load dark mode style sheet first, if required. The theme class is now on thehtml
tag to run this all before DOM load.If this is not the final solution, it is significantly better than the current situation, which is extremely jarring.
I'm noticing a flicker now when loading the page, in the nav bar. It's occurring on my local build with the latest changes, but is not occurring on the production site online. So I'm going to submit this PR so I can see the preview to check for the flicker.
EDIT: After checking, the flicker is there in preview, but is coming from the main branch for me. Doesn't seem to be caused by this PR.