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

Flash when using dark mode #660

Open
4 tasks
lukasjuhrich opened this issue Aug 17, 2023 · 0 comments
Open
4 tasks

Flash when using dark mode #660

lukasjuhrich opened this issue Aug 17, 2023 · 0 comments
Labels
bug 🔨 js Things relating to javascript/typescript code (overlaps with component:ui) 🔨 web/ui Things relating to Flask routes and Jinja templates

Comments

@lukasjuhrich
Copy link
Collaborator

lukasjuhrich commented Aug 17, 2023

Currently, the dark mode is initiated by setting the data-bs-theme attribute on the html tag via some Javascript code.
Due to[1] latency in the execution of JS, this causes a flash.

Workaround

Hard-coding the dark theme as a default before the actual one is loaded would be a workaround, because a dark-then-bright flash is more bearable than a light-then-dark flash.

Better fix

To change bootstrap's behavior to use media queries instead of the data-bs-theme attribute, we need to set the sass attribute $color-mode-type: media-query;. That requires including a sass step in our webpack toolchain.

TODOs

  • workaround: set data-bs-theme="dark", check whether the rest works correctly
  • include sass in our webpack toolchain
  • set the attribute
  • remove the JS code (however, leave some code ensuring the local storage entries we used are deleted)

[1] unnecessarily high, but be that as it may

@lukasjuhrich lukasjuhrich added bug 🔨 web/ui Things relating to Flask routes and Jinja templates 🔨 js Things relating to javascript/typescript code (overlaps with component:ui) labels Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔨 js Things relating to javascript/typescript code (overlaps with component:ui) 🔨 web/ui Things relating to Flask routes and Jinja templates
Projects
None yet
Development

No branches or pull requests

1 participant