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

Dark mode flickers on load of new page #46

Open
JulianWgs opened this issue Nov 27, 2021 · 0 comments · May be fixed by #62
Open

Dark mode flickers on load of new page #46

JulianWgs opened this issue Nov 27, 2021 · 0 comments · May be fixed by #62

Comments

@JulianWgs
Copy link

JulianWgs commented Nov 27, 2021

After activating the dark mode and clicking on any link inside the website the light theme quickly flickers before the page is set to the dark theme again.

An example would be when clicking on the on the posts page from the home page.

Affected browsers:
Firefox 94.0 (64-bit) on Ubuntu 20.04.3 LTS
Chrome Version 95.0.4638.69 (Official Build) (64-bit) on Ubuntu 20.04.3 LTS
iOS 14.8.1

According to StackOverflow this solution is to have a blocking change of theme before the page loads: https://stackoverflow.com/a/63033934

But it seams the theme is changed after the page is ready, hence the flicker:

$(document).ready(function () {
mermaid.initialize({ startOnLoad: true });
if (localStorage.getItem("theme") === "dark") {
$("body").attr("theme", "dark");
$("img, picture, video").attr("theme", "dark");

shafan pushed a commit to shafan/DeepThought that referenced this issue May 21, 2022
For this, I moved the theme attribute from body to the html tag
@shafan shafan linked a pull request May 21, 2022 that will close this issue
shafan pushed a commit to shafan/DeepThought that referenced this issue May 21, 2022
For this, I moved the theme attribute from body to the html tag
tshepang added a commit to tshepang/blog that referenced this issue Jul 24, 2022
- dark mode flickers RatanShreshtha/DeepThought#46
- paginators gone wild RatanShreshtha/DeepThought#60
- landing page shows no posts
tshepang added a commit to tshepang/blog that referenced this issue Jul 24, 2022
- dark mode flickers RatanShreshtha/DeepThought#46
- paginators gone wild RatanShreshtha/DeepThought#60
- landing page shows no posts
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 a pull request may close this issue.

1 participant