Repository navigation
fix(core): dialog text reads the theme, and toast text reaches AA on its card - #12095
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 1173790 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Toast · Storybook | 103.7 kB (+75 B) · 11.1 kB CSS (0) | 1,734 (+7) | — · — · — |
| Dialog | 25.5 kB (+13 B) · 6.9 kB CSS (+15 B) | — | — · — · — |
| BottomSheet | 73.0 kB (+13 B) · 7.7 kB CSS (+14 B) | — | — · — · — |
36 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Drawer | 54.1 kB (+11 B) · 8.4 kB CSS (+13 B) | — | — · — · — |
| lab/Comments | 370.3 kB (+23 B) · 2.5 kB CSS (0) | — | — · — · — |
| Lightbox | 146.0 kB (+21 B) · 11.9 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 363.4 kB (+21 B) · 2.4 kB CSS (0) | — | — · — · — |
| DateTimeInput | 223.6 kB (+16 B) · 19.7 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 88.7 kB (+16 B) · 372 B CSS (0) | — | — · — · — |
| AlertDialog | 128.7 kB (+14 B) · 15.4 kB CSS (0) | — | — · — · — |
| PowerSearch | 306.9 kB (+14 B) · 25.5 kB CSS (0) | — | — · — · — |
| TimeInput | 174.8 kB (+14 B) · 16.9 kB CSS (0) | — | — · — · — |
| SideNav | 121.3 kB (+13 B) · 12.2 kB CSS (0) | — | — · — · — |
| DateInput | 200.1 kB (+12 B) · 17.9 kB CSS (0) | — | — · — · — |
| Overlay | 23.0 kB (+9 B) · 3.9 kB CSS (0) | — | — · — · — |
| TopNav | 78.0 kB (+7 B) · 11.7 kB CSS (0) | — | — · — · — |
| CommandPalette | 77.9 kB (+3 B) · 12.7 kB CSS (0) | — | — · — · — |
| MobileNav | 76.3 kB (+3 B) · 11.4 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 103.0 kB (+2 B) · 18.9 kB CSS (0) | — | — · — · — |
| AppShell | 97.6 kB (+1 B) · 14.3 kB CSS (0) | — | — · — · — |
| MoreMenu | 107.7 kB (+1 B) · 18.8 kB CSS (0) | — | — · — · — |
| Table | 120.2 kB (+1 B) · 19.6 kB CSS (0) | — | — · — · — |
| BottomSheetSwitcher | 18.7 kB (0) · 3.4 kB CSS (0) | — | — · — · — |
| ContextMenu | 102.0 kB (0) · 18.7 kB CSS (0) | — | — · — · — |
| DialogHeader | 67.9 kB (0) · 12.3 kB CSS (0) | — | — · — · — |
| DrawerHeader | 68.0 kB (0) · 13.7 kB CSS (0) | — | — · — · — |
| Markdown | 203.0 kB (0) · 21.9 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 65.4 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| MultiSelector | 101.5 kB (0) · 17.7 kB CSS (0) | — | — · — · — |
| Pagination | 123.8 kB (0) · 19.0 kB CSS (0) | — | — · — · — |
| Popover | 98.7 kB (0) · 15.1 kB CSS (0) | — | — · — · — |
| Selector | 112.9 kB (0) · 18.6 kB CSS (0) | — | — · — · — |
| TableCell | 103.3 kB (0) · 19.1 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 113.7 kB (0) · 773 B CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 114.8 kB (0) · 1.1 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 173.9 kB (0) · 1.9 kB CSS (0) | — | — · — · — |
| DropdownMenu | 107.5 kB (−1 B) · 18.8 kB CSS (0) | — | — · — · — |
| Tokenizer | 104.3 kB (−1 B) · 20.3 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 299.7 kB (−2 B) · 454 B CSS (0) | — | — · — · — |
Package size:
- @astryxdesign/cli 5.13 MB packed (+132 B); no new dependencies
- @astryxdesign/core 7.62 MB packed (+2.2 kB); no new dependencies
- @astryxdesign/theme-gothic 35.8 kB packed (+416 B); no new dependencies
API changes: theme-gothic +1 · ~0 · −0
1 API change (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | theme-gothic |
Stylesheets · var --color-background-error-inverted (./theme.css) |
var --color-background-error-inverted (./theme.css) |
.my-scope { --color-background-error-inverted: …; } |
Wide change (shared styles: packages/themes/gothic/src/gothicPaletteRefs.generated.ts, packages/themes/gothic/src/gothicTheme.ts): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Requesting changes. The dialog reset fixes MobileNav's selected row in gothic light, but three defects need fixing before this can land:
- Gothic's light-mode error toast still draws black text on
#825E59(3.69:1), because the default top-layerToastViewportis a popover whose reset (packages/core/src/Toast/ToastViewport.tsx:109-126) keeps the browser'scolor: CanvasText, so a card that "keeps the page's text" under the new rule actually showsCanvasText; addcolor: 'inherit'beside the viewport'sbackgroundColor: 'transparent'and have the contrast guard (or a Chromium spec) measure a rendered top-layer toast. MobileNav.textColor.a11y.chromium.spec.tsfails at this head, because its background walk stops at the selected row's translucent fill (rgba(0, 0, 0, 0.06)) and reads it as opaque (1.00:1), and it cannot fail on the base, because without Storybook globals both runs render neutral light, where--color-text-primaryequalsCanvasText; load&globals=colorMode:${colorScheme};astryxTheme:gothicand composite translucent layers before taking the ratio.reset.css:347makes dialog text inherit but keeps the browser'sCanvasbackground, so an app's own unstyled<dialog>in gothic light drops from black on white (21:1) to#E8F1F6on white (1.14:1); putcolor: inheriton the Astryx dialog roots, which paint their own surfaces, or reset the colour pair together.
Once the viewport fix lands, please reword the toast figures in the description and changesets. The 3.73–4.16:1 "before" values hold for an in-place viewport; the default top-layer viewport drew white at 4.70:1 there.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- Core changeset: dialog text that sets no colour now uses the theme's text colour. Verified (gothic-light probe;
reset.css:347). - Core changeset: a dark-mode error toast now reaches 4.5:1. True for an in-place viewport; false for gothic light in the default top-layer viewport (3.69:1).
- Gothic changeset: one red in both modes, 4.97:1 in dark where it was 4.11:1. True for the page-text model; the top-layer viewport renders 5.68:1 in dark (4.70:1 before) and black at 3.69:1 in light.
- CLI changeset: the bundled gothic template matches. Verified (files identical).
- The selected row in gothic light was black at 1.44:1. Verified (probe).
- Dark error toasts read 3.73–4.16:1 in five themes before. True for an in-place viewport; the top-layer viewport drew white at 4.70:1.
- Every dialog gets
color: inherit. Verified. - Toast keeps the page text only when it reads at least as well as both on-colours, before and after measuring. Verified in code.
MediaTheme mode="auto"keeps its 3:1 rule. Verified (rule moved unchanged).- The gothic error card reads 4.97:1, and the card 3.28:1 against the page. Verified as computed; in light mode the rendered text is black at 3.69:1.
- The side rules are importable by contrast checks. Verified.
- Palette refs, the CLI copy and the iOS theme are regenerated. Verified (generators reproduce them).
- The default look changes only where text was below AA. False (unstyled dialog in gothic light, 21:1 to 1.14:1).
- Other first-party dialog text already sets its own colour. Not contradicted in the components checked.
- Toast keeps its side wherever the page text read at AA. Verified for first-party themes.
- The contrast check fails before and passes after. Verified for its model; it does not measure rendered text.
- The
pickInvertedSideunit cases. Verified (pass). - The Chromium spec proves the token colour at 4.5:1 in light and dark. False.
- The unit test checks the reset rule. Verified (passes).
- The named Core suites pass. Verified for Toast, MobileNav, hooks and MediaTheme (231 tests); lint passed in CI.
Files:
.changeset/cli-bundled-gothic-error-toast.md: clear.changeset/core-dialog-text-toast-side.md: toast claim holds only for in-place viewports.changeset/theme-gothic-error-toast.md: figures hold only for in-place viewportsdocs/specs/components/MobileNav/MobileNav.spec.md: FR15 verification row unproven by its specdocs/specs/components/Toast/Toast.spec.md: FR14 verification row not met in gothic lightpackages/cli/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts: clearpackages/cli/assets/templates/themes/gothic/gothicTheme.ts: clearpackages/core/src/MobileNav/MobileNav.test.tsx: clearpackages/core/src/MobileNav/MobileNav.textColor.a11y.chromium.spec.ts: fails at head and passes on basepackages/core/src/Toast/Toast.tsx: an'off'side shows the viewport'sCanvasTextpackages/core/src/hooks/mediaSide.ts: clearpackages/core/src/hooks/useAutoMediaMode.test.ts: clearpackages/core/src/hooks/useAutoMediaMode.ts: clearpackages/core/src/reset.css: breaks the colour pair of unstyled dialogs; comment could be shorterpackages/native/apple/Sources/Astryx/Theme/Generated/GothicTheme.swift: clearpackages/themes/gothic/src/gothicPaletteRefs.generated.ts: clearpackages/themes/gothic/src/gothicTheme.ts: clearscripts/check-toast-text-contrast.test.mjs: models the text instead of measuring it
…pecs measure themed, composited colors
|
/approve-spec 2630689 |
There was a problem hiding this comment.
Approved. The three defects from the previous review are fixed and I re-measured each one on this revision in Chromium: the top-layer toast viewport now passes the page's text colour down, so gothic's light error toast reads 4.97:1 where the base rendered black at 2.76:1; MobileNav.textColor.a11y.chromium.spec.ts now loads the Storybook theme and colour-mode globals and composites the row's translucent fill, so it fails on the base (gothic light and dark) and passes here; and the global reset.css rule is gone, so an app's own unstyled <dialog> in a gothic light page still computes black on white.
Two optional wording fixes, neither blocking:
.changeset/theme-gothic-error-toast.mdsays the dark error text "read at 4.11:1" before. That figure belongs to a viewport an app renders in place; in the default top-layer viewport the base rendered white at 4.70:1, and the case that was under AA there is gothic light at 2.76:1. Naming the viewport would keep the release note true for the default setup.- In the description, "black (on gothic's light error card, 3.69:1)" measures black on the red this change introduces; on the base that card is Core's
#AA071E, where black measures 2.76:1. - The same four-line comment is repeated on all four surface roots, and its second sentence runs about 30 words; one short sentence ("The browser gives a dialog
CanvasText, which follows the colour scheme, not the theme.") would fit the source-comment rule better.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Text with no colour of its own in an open MobileNav, Dialog, Drawer or BottomSheet now draws in the theme's text colour. Verified (four surface roots; the open dialog root's computed colour moves from black to
#E8F1F6in gothic light). - Before, such text took the browser's dialog default. Verified (base probe: the selected row is black at 1.44:1 on the panel).
- A toast's text takes the side that reads best on its card. Verified (
mediaSide.tspickInvertedSide, called from Toast's own measurement). - The default top-layer viewport passes the page's text colour down. Verified (
ToastViewport.tsx,color: inherit; rendered gothic light 4.97:1). - A dark-mode error toast now reaches 4.5:1. Verified for all seven first-party themes in the new browser spec.
- Before, it read about 4:1 in a viewport rendered in place. Verified (the base rule over the base themes: 3.73–4.16:1 in stone, gothic, chocolate, butter and y2k).
- Gothic keeps one deep red in both modes and its text reads 4.97:1. Verified; its "4.11:1 before" holds only for an in-place viewport.
- The description's 3.69:1 figure for gothic's light error card. False for the base, where the figure is 2.76:1.
- The bundled gothic template matches the theme package. Verified (the bundler reproduces the committed files byte for byte).
- The selected row in gothic light was 1.44:1 and now measures 12.78:1. Verified.
- Every other theme's selected row measures 8.19–15.21:1. Verified across all seven themes in both modes.
- Neutral changes zero pixels. Verified (the before and after frames are byte-identical).
- No other text in a dialog, drawer or sheet moves. Verified for an open Dialog and an open Drawer in gothic light (unchanged colour census, pixel-identical frames).
MediaTheme mode="auto"keeps its 3:1 rule. Verified (the rule moved modules unchanged).- The pre-measurement pick uses the same rule. Verified (both rules agree when no page colour is passed).
- The side rules are importable by contrast checks. Verified (the guard imports them with no React or StyleX in the graph).
- The contrast guard fails those five themes before and passes after. Verified for the token model.
- The browser specs fail on the base and pass at the head. Verified (three failures on the base, eighteen passes here).
- Palette references, the bundled copy and the iOS theme are regenerated. Verified by re-running each generator.
- The named suites and repository checks pass. Verified here for the Toast, MobileNav, hooks, theme, Dialog, Drawer and BottomSheet suites (1,217 tests), the knowledge check and the changeset check; lint and the rest are green in this revision's CI.
Files:
.changeset/cli-bundled-gothic-error-toast.md: clear.changeset/core-dialog-text-toast-side.md: clear.changeset/theme-gothic-error-toast.md: the 4.11:1 figure holds only for an in-place viewportdocs/specs/components/BottomSheet/BottomSheet.spec.md: clear (FR25 matches the sheet's new declaration)docs/specs/components/Dialog/Dialog.spec.md: clear (FR10 added, table reflow only)docs/specs/components/Drawer/Drawer.spec.md: clear (FR21)docs/specs/components/MobileNav/MobileNav.spec.md: clear (FR15, its verification row and the new spec inverified_by)docs/specs/components/Toast/Toast.spec.md: clear (FR14, its verification row and threeverified_byentries)packages/cli/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts: clear (regenerates identically)packages/cli/assets/templates/themes/gothic/gothicTheme.ts: clear (regenerates identically)packages/core/src/BottomSheet/BottomSheetPanel.tsx: clear; comment style note abovepackages/core/src/Dialog/Dialog.tsx: clear; comment style note abovepackages/core/src/Drawer/Drawer.tsx: clear; comment style note abovepackages/core/src/MobileNav/MobileNav.test.tsx: clearpackages/core/src/MobileNav/MobileNav.textColor.a11y.chromium.spec.ts: clear (red on the base, green here)packages/core/src/MobileNav/MobileNav.tsx: clear; comment style note abovepackages/core/src/Toast/Toast.tsx: clear (measures its own card, outside the media subtree, so no feedback loop)packages/core/src/Toast/ToastViewport.tsx: clearpackages/core/src/Toast/__tests__/ToastTextContrast.a11y.chromium.spec.ts: clear (red on the base for gothic light, green here)packages/core/src/hooks/mediaSide.ts: clear (named by the approved Toast row; React-free so the guard can import it)packages/core/src/hooks/useAutoMediaMode.test.ts: clearpackages/core/src/hooks/useAutoMediaMode.ts: clear (one shared measurement body; the auto rule and its parent target are unchanged)packages/native/apple/Sources/Astryx/Theme/Generated/GothicTheme.swift: clear (regenerates identically)packages/themes/gothic/src/gothicPaletteRefs.generated.ts: clear (the references check passes in the theme build)packages/themes/gothic/src/gothicTheme.ts: clear (one named stop, the same in both modes)scripts/check-toast-text-contrast.test.mjs: clear (its model now matches what the browser paints)
| '@astryxdesign/theme-gothic': patch | ||
| --- | ||
|
|
||
| [fix] The error toast keeps one deep red in both modes, so its text reads at 4.97:1 in dark mode, where it read at 4.11:1. |
There was a problem hiding this comment.
The 4.11:1 figure is the one a viewport an app renders in place produced. In the default top-layer viewport the base rendered white at 4.70:1 on #E3193B, and the case that was under AA there is gothic light, where the base drew black at 2.76:1 on #AA071E. Naming the viewport, or quoting the light-mode figure, keeps the release note true for the default setup.
| flexDirection: 'column', | ||
| backgroundColor: colorVars['--color-background-surface'], | ||
| // The surface's text color. The browser gives a dialog and a popover | ||
| // CanvasText, which follows the color scheme and not the theme, so text |
There was a problem hiding this comment.
This sentence runs about 30 words and the same four lines are repeated on the Dialog, Drawer and BottomSheet roots. One short sentence carries the quirk: "The browser gives a dialog CanvasText, which follows the colour scheme, not the theme." (source comments, architecture:knowledge-contracts INV29). Non-blocking.
User impact
Two places draw text below WCAG 2.2 AA (SC 1.4.3, 4.5:1 for normal-size text) in first-party themes:
<dialog>the panel renders setscolor: CanvasText. That value follows the color scheme, not the theme, so it is black in light mode whatever the panel paints.CanvasText, so there a card that keeps the page's text drew the browser's white (4.70:1 in dark) or black (on gothic's light error card, 3.69:1).Problem and solution fit
--color-background-surfaceinside a dialog (MobileNav's panel, Dialog, Drawer, BottomSheet's sheet) set their text color to--color-text-primary, the pair to the surface they paint. Text in them that sets no color of its own draws in the theme's color. Core's reset is unchanged, so an app's own unstyled<dialog>keeps the browser's color pair.--color-on-darkor--color-on-light) that reads best on the painted card. It keeps the page's text only when that reads at least as well as both, which is the case on a pale surface a theme calls inverted. The same rule drives the pre-measurement pick (FR13).MediaTheme mode="auto"keeps its own 3:1 rule; only Toast's choice changes.Expected behavior and authority
component:MobileNavFR15: text in the open panel that sets no color draws in the page's text color.component:ToastFR14: the measured side rule. FR13 picks by the same rule.Smallest restoration
color: --color-text-primaryon the four surface roots;color: inheriton the toast viewport.hooks/mediaSide.ts: the side rules as pure functions (pickMediaMode, unchanged, andpickInvertedSide), so contrast checks can import them.useAutoMediaModegainsuseSurfaceMediaMode, which measures the element itself with a given rule. Toast passes its measured side toMediaThemeexplicitly.--color-background-error-inverted. Its palette refs, the CLI's bundled gothic copy and the generated iOS theme are regenerated.What moves. I took before/after pictures in Chromium of every official theme's editor sheets (the sample page, the component sheet, the actions sheet, and the overlays sheet with every dialog, drawer, sheet, menu and toast drawn open), in light and dark. The only change between the two is the dialog text color. I also compared the color of every text node inside a dialog:
The selected row moves from the browser's black (light) or white (dark) to the theme's own
--color-text-primary, the color the theme gives every other primary text. Examples: gothic#000→#e8f1f6(the failing case, 1.44 → AA); stone#000→#25252a; chocolate#fff→#ede4d4. No other text in any dialog, drawer, sheet or menu moves, because all of it sets its own color. A narrower rule would move the same row, since the row is the one element that inherits. Toast picks the same side as before wherever the page's text read at AA.Gothic's light error toast also changes. It moves from Core's crimson to gothic's own palette blood red, still AA at 4.97:1. Gothic never set this token, so Core's two-mode default showed through. Gothic's rules keep every color one palette value, the same in both modes, so a dark-only red is not available there.
Evidence
scripts/check-toast-text-contrast.test.mjs: every first-party theme, light and dark, info and error cards. The text Toast picks is at least 4.5:1 (WCAG 2.2 SC 1.4.3). Before this change it fails stone, gothic, chocolate, butter and y2k in dark.useAutoMediaMode.test.ts:pickInvertedSidetakes the better on-color where the page text clears 3:1 but an on-color reads better. It keeps the page text where that reads at least as well as both, and gives up on an unreadable on-color.MobileNav.textColor.a11y.chromium.spec.ts, gothic and neutral, light and dark (loaded through the Storybook theme and color-mode globals): the open panel's selected row is drawn in the panel's resolved--color-text-primary, at least 4.5:1 on the panel with translucent layers composited.MobileNav.test.tsxchecks the panel's declared color.ToastTextContrast.a11y.chromium.spec.ts, every first-party theme, light and dark: the rendered error toast in the default top-layer viewport is at least 4.5:1 on its card.Scope
Components: MobileNav, Toast, theme-gothic
Testing
tsc --noEmit,pnpm check:knowledge, the changeset check and changeset coverage pass.Writing rubric results
Run over the record edits in
component:MobileNav(FR15 and its verification row) andcomponent:Toast(FR14 and its verification row).R1 narration: none; each sentence states what the panel or card draws.
R2 research: none.
R3 evidence: the basis and verification cells name tests, not a pull request.
R4 rejected alternatives: none recorded.
R5 change references: none.
R6 open questions: none touched.
R7 project status: none.