Skip to content

Fix: Color Mode Switcher shows wrong icon in auto mode #546 #547

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

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

Conversation

nenadvicentic
Copy link

Root cause (different handling for null and auto values) contributes to occasional flickering.

@julien-deramond
Copy link
Member

Thanks for the PR! Apologies for the delay in reviewing it. I’ve tested it but wasn’t able to reproduce the occasional flickering issue that could happen in the main branch. I’m going to close this for now, but if you can provide more detailed steps or additional context, feel free to comment here and we’ll gladly reopen it.

@nenadvicentic
Copy link
Author

nenadvicentic commented Jun 3, 2025

Hi @julien-deramond

Apologies for not so clear pull request description. Regardless of flickering issue (which turned out to be present only in Chrome, not in FF, when script tag is in the page header), you have a bug in the current switcher.

You can see it when you land on a website that uses themes and switcher and there is no local storage value auto stored yet (e.g. landing on a website for the first time).

If your OS is in the light mode, the switcher will show "Light mode" option as selected. If your OS is in the dark mode, switcher will show "Dark mode" option, when, instead, it should show "auto", since "auto" means "whatever is selected in the OS".

…ntributes to occasional flickering. twbs#546

- Unifies 'auto' and `null` handling for `theme` to simplify code and avoid occasional flickering.
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.

2 participants