Components: a dark dialog owns its surfaces, not just its text - #622
Open
AllTerrainDeveloper wants to merge 1 commit into
Open
Components: a dark dialog owns its surfaces, not just its text#622AllTerrainDeveloper wants to merge 1 commit into
AllTerrainDeveloper wants to merge 1 commit into
Conversation
Mio's shape picker rendered unthemed inside its style panel: a white <os-select> trigger with near-white text on it. <os-modal> renders a dark dialog whatever the palette says, so it re-points the tokens its content reads on its own :host. It re-pointed the foreground — --os-ui-fg, --os-ui-fg-muted, --os-ui-border — and --os-window-bg for popovers and inputs, but not --os-ui-surface, which is what <os-select> paints its trigger from. That was invisible for as long as the palette outside the dialog was dark too: every token left behind happened to agree. Under a LIGHT palette the halves come apart. Legacy sets --os-ui-surface to #fff, so the trigger went white while the re-pointed --os-ui-fg wrote #f0f0f1 onto it. --os-ui-hover was rgba(0,0,0,0.04) over a dark row, which is no hover at all. Foreground and surface are a pair. The escape hatch now covers both: --os-ui-surface, --os-ui-surface-elevated, --os-ui-border-strong and --os-ui-hover join the set, each reading a palette-owned --os-ui-modal-* name so a theme keeps the last word. Pre-existing — not from the Legacy sweep, --os-ui-surface has been #fff in the snapshot since it was collected. The sweep made enough of the panel correct for the one wrong control to stand out. Guard: a dark-context opt-out has to be closed, so the reachability test now asserts the fg/surface pairs are re-pointed together rather than trusting the next person to notice the second half. Docs: the copy-paste recipe in components-reference.md was the same list, so it taught the bug. It carries all nine tokens now, grouped foreground / surface / wash, with the reason the incomplete version looks correct until a light theme is worn. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The bug
Mio's shape picker renders unthemed inside its style panel: a white
<os-select>trigger with near-white text on it.<os-modal>renders a dark dialog whatever the palette says, so it re-points the tokens its content reads on its own:host. It re-pointed the foreground —--os-ui-fg,--os-ui-fg-muted,--os-ui-border— plus--os-window-bgfor popovers and inputs. It did not re-point--os-ui-surface, which is what<os-select>paints its trigger from.--os-ui-fg#fffbff#1d2327#f0f0f1--os-ui-surface#1a1721#fff--os-ui-hoverrgba(0,0,0,.04)This was invisible for as long as the palette outside the dialog was dark too — every token left behind happened to agree, and the dialog looked right. Under a light palette the halves come apart: the trigger goes white while the re-pointed
--os-ui-fgwrites#f0f0f1onto it, and the hover wash is black over a dark row.Pre-existing, not from the Legacy sweep —
--os-ui-surfacehas been#fffin the snapshot since it was collected. #620 made enough of the panel correct for the one wrong control to stand out.The fix
Foreground and surface are a pair. The escape hatch now covers both —
--os-ui-surface,--os-ui-surface-elevated,--os-ui-border-strongand--os-ui-hoverjoin the set, each reading a palette-owned--os-ui-modal-*name so a desktop theme keeps the last word.The four new palette names are literals, so Legacy answers them (463 tokens), per the rule #620 established.
Guard
A dark-context opt-out has to be closed. The reachability test now asserts the fg/surface pairs are re-pointed together, rather than trusting the next person to notice the second half:
plus
--os-ui-hover, which belongs to the surface it darkens.Docs
The copy-paste recipe in
components-reference.mdwas the same incomplete list, so it was teaching the bug to anyone slotting components into their own dark surface. It carries all nine tokens now, grouped foreground / surface / wash, with the note that the short version looks correct until a light theme is worn.desktop-themes.mdgets the same correction on the<os-modal>exception.Testing
PHPUnit 2214 passed (Legacy class: 20 tests, 5660 assertions) ·
lint:phpclean · vitest 4479 passed (reachability: 60) · typecheck clean ·npm run buildclean.Manual QA
Wear Legacy, open Mio → style panel. The Shape select should read as a dark control on the dark dialog — dark trigger, light label — and hovering its options should show a visible wash. Same check applies to any
<os-modal>with form controls in it.🤖 Generated with Claude Code