Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

馃悰 Fixed flash of unstyled content appearing when toggling night mode #1818

Merged
merged 2 commits into from
Jan 12, 2021

Conversation

harshmaur
Copy link
Contributor

@harshmaur harshmaur commented Jan 9, 2021

closes TryGhost/Ghost#12396

We use two stylesheets ghost-light.css and ghost-dark.css for light mode and night mode respectively.
The problem occurs when we disable the light stylesheet when we enable dark stylesheet, as there is a moment when there is no style applied
This causes flash of unstyled content (or a big logo when users flip the night mode switch)

Since the ghost-dark style is loaded after the ghost-light stylesheet, we only need to enable or disable the dark stylesheet.
When the dark stylesheet is enabled, the light stylesheet will be overridden automatically by the browser.
I could not find any performance implications on overriding styles. The only performance implication is around loading a new stylesheet
which we already do.

Got some code for us? Awesome 馃帄!

Please include a description of your change & check your PR against this list, thanks!

  • There's a clear use-case for this code change
  • Commit message has a short title & references relevant issues
  • The build will pass (run ember test from the repo root - will be core/client if working from the submodule in Ghost).

More info can be found by clicking the "guidelines for contributing" link above.

harshmaur and others added 2 commits January 9, 2021 13:35
closes #12396
We use two stylesheets ghost-light.css and ghost-dark.css for light mode and night mode respectively.
The problem occurs when we disable the light stylesheet when we enable dark stylesheet, as there is a moment when there is no style applied
This causes flash of unstyled content (or a big logo when users flip the night mode switch)

Since the ghost-dark style is loaded after the ghost-light stylesheet, we only need to enable or disable the dark stylesheet.
When the dark stylesheet is enabled, the light stylesheet will be overridden automatically by the browser.
I could not find any performance implications on overriding styles. The only performance implication is around loading a new stylesheet
which we already do.
馃悰 Fixed flash of unstyled content appearing when toggling night mode
@kevinansfield
Copy link
Collaborator

Thanks @harshmaur

@kevinansfield kevinansfield merged commit 90343a5 into TryGhost:master Jan 12, 2021
@mcnaveen
Copy link

Wow. Thanks @harshmaur

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants