fix: web theme toggle shows light/dark only, never the system icon - #703
Open
time-attack wants to merge 1 commit into
Open
fix: web theme toggle shows light/dark only, never the system icon#703time-attack wants to merge 1 commit into
time-attack wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The web UI's theme toggle (
<theme-toggle>from@mariozechner/mini-lit) would sometimes render the computer/monitor (system) icon instead of sun/moon.Root cause is in the third-party component:
localStorage.themekey as"system".getIcon()returns theMonitoricon whenevertheme === "system"— regardless of theincludeSystemprop.So any user who never set a theme (fresh load), or whose 3-state cycle landed on system, got the computer icon. We can't edit the compiled dependency, so this is fixed at our only consumer,
plugins/web-ui/src/shell.ts.Fix
.includeSystem=${false}— the toggle cycles light ↔ dark only and can never land on system.light/darkintolocalStorage.themefrom the OSprefers-color-schemewhen none is set, so the element never initializes to"system"and never paints the Monitor icon.Behavior
First load reflects the user's OS preference (light or dark); after that the toggle just flips light↔dark. This intentionally drops OS-follow behavior in favor of an explicit two-state toggle — the reported bug was the system/computer state being unwanted.
Verification
tsc --noEmitclean, prettier + oxlint clean on the changed file.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.