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

Flickering theme icon when navigating #932

Open
OmTheTurtle opened this issue Nov 14, 2021 · 0 comments
Open

Flickering theme icon when navigating #932

OmTheTurtle opened this issue Nov 14, 2021 · 0 comments
Labels
bug Something isn't working low priority No hurry, this can wait. UI / UX Affects the UI and UX of app

Comments

@OmTheTurtle
Copy link
Member

When navigating between pages using dark mode, we can see the moon icon showing for a split second and then change to the sun icon. This is due to the fact that we're changing the icon based on a cookie client-side in a non-blocking JS file (main.js, line 44).

I see two possible solutions:

  • extract the theme changing logic to a separate file and add that to the head instead of the body to act as a render-blocking resource. This way when the browser renders the HTML the correct classes will be added, but it could negatively impact SEO / web vitals
  • use some logic to add the hidden class based on the cookie in the template rather than in a separate JS file, so it'll run on the server instead of the client, similar to how we add the colors to the heatmap (we have theme as a global variable available for that).
@OmTheTurtle OmTheTurtle added bug Something isn't working UI / UX Affects the UI and UX of app low priority No hurry, this can wait. labels Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority No hurry, this can wait. UI / UX Affects the UI and UX of app
Projects
None yet
Development

No branches or pull requests

1 participant