Repository navigation
Conversation
|
@AKnassa is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
|
I have some distinct palette colors used for each theme. I’ll have a separate PR for this issue. Thanks for flagging :) We also might introduce different contrast modes to hit different color accessibility ratings |
|
The approach here is exactly right and the bulk still applies cleanly to
Everything else (the |
Retune the core default palette and all 7 shipped themes so every real foreground/background pairing clears WCAG 2.1 AA (4.5:1 text, 3:1 non-text UI) in both light and dark modes — 258 measured failures to 0. Component fixes independent of any theme: ChatToolCalls, the ChatComposer placeholder, and dictation interim text no longer paint active content with the disabled token; Calendar outside-month days no longer stack disabled opacity on top of their own de-emphasis; tinted Card variants re-bind text tokens to the matching hue colour (Banner's existing pattern); Lightbox captions/controls sit on a fixed dark chip so they stay readable over any media. Adds internal/theme-contrast: a cross-theme contrast contract that resolves every theme's tokens (alpha compositing, light-dark(), var() chains, per-theme component overrides included) and fails CI on any regression — the automated check requested in the issue. Fixes meta#3654
) This branch was cut before main migrated to Vitest 4 and split the config into `ui` and `node` projects. Under the old flat config, the root `resolve.alias` mapped `@astryxdesign/core/*` to source for every test, so internal/theme-contrast/contrast.test.ts resolved fine. The `node` project deliberately does not `extends: true`, so it inherits neither that alias nor the StyleX babel plugin — and `internal/**` is in its include list. After rebasing onto main the suite failed to collect: Cannot find package '@astryxdesign/core/theme' and, once pointed at source directly, failed again on Unexpected 'stylex.defineVars' call at runtime because `@astryxdesign/core/theme` reaches theme/tokens.stylex.ts through defineTheme.ts:53. The suite genuinely needs StyleX compilation, so it belongs in `ui`. Claimed there and excluded from `node`, scoped to this one directory so no other internal/ suite changes projects. Restores the pre-migration behaviour rather than changing what is tested: 43 tests across the 3 theme-contrast files pass again.
bb5ae0d to
ea82088
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Rebased onto Three conflicts, none mechanical:
The second commit fixes a break the rebase exposed. This branch predates the Vitest 4 split. The After the rebase: Does not fix Still needs the annotated before and after screenshots. |
PR Analysis ReportModified ComponentsCalendar
Card
Chat
Lightbox
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. Chat - 1 issue(s)
Generated by PR Enrichment workflow | View full report |
|
Thanks @AKnassa — this was a big, careful audit and both halves of it are now true on main, just not through this PR. The tokens landed in #4557 (neutral's light secondary darkened past AA), and #3654 closed on 31 July. The automated check you proposed also exists now — Closing as superseded rather than as anything you got wrong. You were right about the problem and right about needing a check rather than a one-off fix. Reopening is welcome any time — merge main in first, since the branch has aged. Discord if you'd rather talk it through with a person. [Reviewed by Robohands] |
Fixes #3654
What this does
Makes text and icons readable again, everywhere. Every theme that ships with Astryx (plus the default palette) now meets the WCAG 2.1 AA contrast standard in both light and dark mode — and a new automated check keeps it that way on every future PR.
Why
The issue showed muted text failing the 4.5:1 contrast requirement across the design system. A full audit found it was bigger than the screenshots: 258 failing colour pairings across the 8 palettes. Products built on Astryx would fail accessibility audits out of the box.
What changed
#737373(4.2:1 on its grey background — fail) to#616161(4.8:1 — pass).internal/theme-contrast/) runs as part of the normal test suite on every PR. It computes real WCAG ratios from the theme tokens — including see-through colours layered on surfaces and per-theme component restyling — so a regression fails CI with the exact offending pair and numbers. 0 failures across all 16 theme/mode combinations today.One deliberate look change
In dark mode, the default theme's primary buttons and info/success/error badges now use near-black labels on their bright fills instead of white (white only reached 3.1:1 on the bright dark-mode blue). This follows the same rule the warning badge and the neutral theme already use.
How to see it
CONTRAST_REPORT=1 pnpm vitest run internal/theme-contrastprints the full audit table for every theme and mode.Not in this PR (follow-ups)
check-componentsfilters outtheme/paths) — the new test covers that gap, but the filter may be worth revisiting.import-hint-correctness.test.mjsfailures exist onmainand are unrelated.