Skip to content
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

no flashing when reloading in light or dark mode #12173

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gordonwoodhull
Copy link
Contributor

@gordonwoodhull gordonwoodhull commented Feb 27, 2025

fixes #1325

Introduces a new script before the body which runs immediately, enabling or disabling dark mode.

Also, both light and dark stylesheets are loaded at once, and then one immediately disabled, instead of dark starting as rel="prefetch", which was one of the causes of flashing.

Submitting as a draft for three reasons:

  1. It's a pretty big change to the structure of the HTML, would appreciate folks giving it a look-over and/or testing.
  2. It does not degrade nicely when JavaScript is disabled - want to investigate if there is an alternative that does load the dark stylesheet eagerly but disables it. 1
  3. I'm out next week and don't want to check in this big a change before I go.

Footnotes

  1. Worst case, it does work to load the light stylesheet after the dark stylesheet, with a few fixes to the JS that currently depend on stylesheet order.

fixes #1325

introduces a new script before the body
which runs immediately, enabling or disabling dark mode

TODO: needs to degrade properly when JS is disabled
@gordonwoodhull gordonwoodhull added this to the v1.7 milestone Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flashing when switching between pages in dark theme.
1 participant