Repository navigation
Conversation
The default --color-error dark half (#F5394F) held white label text at 3.76:1 — below WCAG 1.4.3's 4.5:1 — so any theme that left the status colours alone rendered a failing destructive button in dark mode. Use #E3193B in both modes (the --color-success precedent; the hex is already the dark half of --color-background-error-inverted), which measures 4.70:1 under white and stays above the 3:1 non-text floor against the dark surfaces for the destructive focus ring. Adds contrast assertions over the colorDefaults fall-through pairs (error, success, warning, default accent) so a retone cannot regress silently. The dark accent stays pinned at the 1.4.11 floor: it is also the focus outline, and darkening it to clear 4.5:1 under white would break the ring against dark surfaces — deriving that pair inside the generator guarantee is tracked with meta#5014. Fixes meta#5019
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsChat (@astryxdesign/core) · View in Storybook
TextArea (@astryxdesign/core) · View in Storybook
LogStream (@astryxdesign/lab) · View in Storybook
Stat (@astryxdesign/lab) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 2 accessibility violation(s) found — 2 serious. Chat - 1 issue(s)
LogStream - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Self-review round on the meta#5019 token change. LogStream's dark error-level text derives from the error token via an 82% color-mix that was tuned to clear 4.5:1 for small text against the old #F5394F; the darker #E3193B silently invalidated that tuning (4.21:1 on the surface, 4.06:1 over the 6% row wash). 72% restores 4.86:1 / 4.69:1 and keeps the derivation on the themeable token. The destructive focus-ring assertion now covers body and popover, not just the default surface, making the changeset's "against the dark surfaces" plural literally the asserted guarantee. The dark popover pair sits at 3.09:1 with ~0.1 of headroom; the test pins it so a popover retone cannot cross the 3:1 floor silently. Refs meta#5019
The error fill token is tuned for solid fills under white foregrounds; as dark-mode text it sat below WCAG AA even before meta#5019 darkened it (4.37:1 on the surface), and the darkening pushed every text use lower. Migrate the supporting/status text roles to --color-text-red — the pairing FieldStatus and ChatComposer already ship — taking those reads from failing to 8.5-11:1 in dark mode: - Chat: message metadata error status, tool-call deletions stat and error status color (the icon's currentColor tint halo follows), and the dead errorText key for consistency - TextArea and lab RichTextEditor: over-limit counter - lab ChatUnreadDivider: label (the 1px rule keeps the fill token — a redundant cue that passes 3:1 as a fill) - lab Stat: negative delta Each migration landed red-first: a test pinning the element's atomic color rule to the text token's var reference failed against the fill token, then passed after the one-line change. Also softens the accent-floor test comment (the ring would sit at the 1.4.11 floor, not below it) and notes the sweep in the changeset. Refs meta#5019
Resolves the PR meta#5025 conflict. Upstream promoted RichTextEditor out of packages/lab into the new @astryxdesign/richtext package (meta#4678), which is what GitHub reported as conflicting; git rename detection carried the --color-text-red counter change to packages/richtext/src/RichTextEditor.tsx along with its test. No hand edits were needed - the only lines the merge dropped were unrelated prettier reflow.
|
Merged main in. The conflict was the RichTextEditor move into Separately, a call I would like from you before review. Every shipped consumer of
The other five themes are unaffected or improve, including default dark at 3.50 to 9.64. y2k light improves 1.50 to 9.13; only its dark half regresses.
Options as I see them: retone |
|
Hi @AKnassa, great writeup - the two-move split (retone the fill token + move text consumers to the text token) is exactly the right shape for this problem, because as you note the fill and text luminance windows genuinely don't overlap. I verified the core numbers independently against WCAG 2.1 (relative luminance, 4.5:1 normal text / 3:1 non-text):
A few things I'd want checked or pinned before this lands: 1. The DropdownMenuItem trade-off deserves a decision, not a deferral. 2. The accent/on-accent dark pin at 3:1 is the right call, but the test comment could warn louder. 3. LogStream retune 82% -> 72%: worth confirming the "failed to send" case. 4. Small thing: the injected-CSS test helper is duplicated across 5 test files. Overall: this is a strong, well-measured fix. The token-vs-text separation is the correct model and the regression assertions are the right guard. My main ask is to turn the DropdownMenuItem deferral into an explicit decision with a pinned test, and to de-duplicate the CSS-scan helper. |
|
Thank you for the measured dark-mode contrast work. Color-token and palette changes are now coordinated as owner-led accessibility work rather than parallel implementation PRs. Please follow #4475 for the program direction; we are closing this attempt. |
Fixes #5019.
What
Two moves, one goal: the error colour meets AA in dark mode without trading one failure for another.
1. The token. The default
--color-errornow uses#E3193Bin both modes — the same shape as--color-success, which already shares one hex across modes. The dark half was#F5394F, which held white label text at 3.76:1, below WCAG AA's 4.5:1 for normal text, so any theme that left the status colours alone rendered a failing destructive button in dark mode.#E3193Bis one step darker on the same ramp and is already the dark half of--color-background-error-inverted, so white-on-#E3193Bin dark mode was an approved pairing in this palette before this change.2. The text roles. Measuring every
--color-errorconsumer (43 across core/lab/charts) showed the token also paints text — and no single hex can clear 4.5:1 under white as a fill and 4.5:1 as text on the dark surfaces; the luminance windows don't overlap. The fill token was already below AA as dark text before this change (4.37:1 on the surface, 3.87:1 on the popover). Components rendering supporting/status text in the fill token now use--color-text-red, the pairing FieldStatus and ChatComposer already ship: Chat message metadata ("failed to send"), Chat tool-call stats and errors (the error icon'scurrentColortint halo follows its glyph), the TextArea and RichTextEditor over-limit counters, lab's ChatUnreadDivider label (its 1px rule stays on the fill token — a redundant cue that passes 3:1) and Stat's negative delta. Each carries a test pinning the element to the text token. LogStream's derived dark mix retunes 82% → 72% to keep its documented 4.5:1 against the darker token.A contrast assertion now covers the default pairs that fall through to
colorDefaults(error, success, warning, and the default accent), plus the error fill against surface, body, and popover, so a future retone cannot regress silently. The regenerated CLI token doc rides along (generate-token-docs.mjs). All seven shipped themes retone both--color-errorand--color-on-error, so none inherits the change.Measured
Same probe as the issue — the rendered DOM (base tokens,
getComputedStyle):--color-error(destructive button)--color-error(light mode)--color-errorvs surface / body / popover (destructive focus ring, ≥ 3:1)--color-text-red)The dark popover ring pair sits at 3.09:1 with ~0.1 of headroom; a test pins it so a popover retone cannot cross the floor silently.
Deliberately left as-is, for review
DropdownMenuItemlabel on the dark popover: 3.87 → 3.09. It was below AA before this change; moving it to--color-text-redwould also recolour the destructive action's identity in both modes, which feels like its own call. Happy to include it here or split it out.--color-error-mutedwash (2.66 vs the composited wash) and CircularProgress's error arc vs its muted track (2.66): the adjacent title names the status and the track is the decorative rail, so both arguably fall under the redundant-cue/rail exemptions the test file already documents. Rebasing the dark wash on the new hue only reaches 2.89–3.03, so there is no clean token-level fix.--color-error-muteddark still derives from the old hue (#F5394F3Fvs light's#E3193B33). Text on the wash is always--color-text-red(FieldStatus, ChatComposer, Banner), so nothing reads on it; kept to avoid visual churn.--color-on-accent/--color-accent(3.11:1 dark) is not retoned:--color-accentis also the focus outline, and a dark accent that clears 4.5:1 under white lands at ~3.05:1 against the surface — the ring would sit at the 1.4.11 floor with no margin. The assertion pins the pair at its current floors (light ≥ 4.5, dark ≥ 3); deriving it inside the generator's guarantee is the durable fix, per the issue's own split with Overriding one side of a colour pair silently voids the contrast guarantee #5014.How to check
pnpm exec vitest run packages/core/src/theme/expandColorScale.test.ts— thecolorDefaults WCAG contrast on the fall-through pairs (#5019)block fails at 3.763 without the token change and passes with it.Screenshots