Repository navigation
test(Toast): a fallback toast keeps its Theme under a host-themed root, in Chromium - #12995
nynexman4464 wants to merge 3 commits into
Conversation
…t, in Chromium The fallback toast viewport draws a toast under the Theme it was shown from. The tests for that rule run in jsdom, which applies no scoped theme CSS and paints nothing. They prove which Theme wraps the card, not which rules reach it or what color its text paints. Add a story with a page Theme, a second Theme around one region, and no LayerProvider. Add a Chromium spec that themes the root element as a host page does, shows a toast from each Theme, and checks the theme whose rules reach the card and the text contrast on it, in light and in dark.
… toolbar theme, settle the root scheme
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested for one fix to the description; the story and the Chromium spec are sound.
- The Testing section says
pnpm review:prereports 220 authored lines, but at this head it reports 223 (53 in the stories file, 170 in the spec): correct the number or drop it.
The spec passes at this head, and with the caller's Theme removed from the fallback entry it fails all four cases with the Theme, radius and contrast values the description gives.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Verified: the fallback viewport draws a toast under the Theme it was shown from (
useToast.tsx:142-160,ToastViewport.tsx:392-410). - Verified: the existing jsdom tests assert only which Theme wraps the card (
useToast.test.tsx:235-265). - Verified: the story's toolbar theme
noneleaves no Theme orLayerProviderabove it (.storybook/preview.tsx:70-84). - Verified: the spec waits for the page Theme and Storybook's root color scheme, then themes the root as a host does (spec lines 79-97).
- Verified: the spec checks the card's Theme, its radius from that Theme's tokens and its text contrast under a light and a dark host, with both story Themes light (spec lines 157-170).
- Verified: with the caller's Theme removed, all 4 cases fail on all three checks (
host, 12px, 1.0:1 and 1.3:1), by a red run. - Verified: all 4 cases pass in 3 runs in a row (12 of 12).
- Verified: no shipped file, record, workflow or CI script changes, and the scope line runs the spec for Toast, theme and Toast-story changes.
- False: the pre-review command reports 220 authored lines; it reports 223 (its 0 findings and clean merge hold).
apps/storybook/stories/Toast.stories.tsx: clear.packages/core/src/Toast/__tests__/ToastFallbackTheme.a11y.chromium.spec.ts: clear.
There was a problem hiding this comment.
Approved pending CI: the pull request is a draft, so CI has not run on this head yet; it runs once the pull request is marked ready for review.
The earlier request is resolved: the Testing section's pnpm review:pre count now reads 223, which matches this head. The Chromium spec passes here and fails all four cases with the caller's Theme removed from the fallback entry, so it guards the rule it targets.
Claims and files checked
Review mode: same-head; reason: none
- Changed rules (0): none.
- Verified: the fallback viewport draws a toast under the Theme it was shown from, and that fix has landed on
main(useToast.tsx:142-160,ToastViewport.tsx:392-410). - Verified: the defect was unreadable toast text, 1.0:1 to 1.3:1, under a host-renamed root, by a red run.
- Verified: the existing jsdom tests assert only which Theme wraps the card (
useToast.test.tsx:235-265). - Verified: the description's paraphrases of the theme-application invariant, the host-rewrite rule before it, and Toast's contrast requirement with its 4.5:1 check match the current records, and no record changes.
- Verified: the story pins the toolbar theme to none, so no
LayerProvideris above it and both toasts use the fallback viewport (.storybook/preview.tsx:70-83). - Verified: the spec waits for the page Theme and Storybook's root color scheme, then themes the root as a host does (spec lines 79-97).
- Verified: the spec checks the card's Theme, its radius from that Theme's tokens and its text contrast under a light and a dark host, with both story Themes light (spec lines 157-170).
- Verified: with the caller's Theme removed, all 4 cases fail on all three checks (
host, 12px, 1.0:1 and 1.3:1). - Verified: all 4 cases pass in 3 runs in a row against
main's Toast and theme code. - Verified: no shipped file, workflow or CI script changes; the spec-routing helper finds the spec through the Toast folder, and the scope line runs it for Toast, theme and Toast-story changes.
- Verified: no public API, behavior or policy change, and no internal context in the pull request text or code.
- Verified: the pre-review command reports 0 findings, 223 authored lines and a clean merge into
main. apps/storybook/stories/Toast.stories.tsx: clear.packages/core/src/Toast/__tests__/ToastFallbackTheme.a11y.chromium.spec.ts: clear.
…st-fallback-theme-browser
There was a problem hiding this comment.
Approved pending CI: some required checks are still running on this head.
The merge of main leaves this pull request's own changes untouched, so the earlier approval carries forward. The Chromium spec passes all four cases in CI's accessibility contracts job on this head and fails all four with the caller's Theme removed from the fallback entry, so it guards the rule it targets.
Claims and files checked
Review mode: carry-forward; reason: none
- Verified: the fallback viewport draws a toast under the Theme it was shown from, and that fix is on
main(useToast.tsx:142-160,ToastViewport.tsx:392-410). - Verified: the defect was unreadable toast text, 1.0:1 to 1.3:1, under a host-renamed root, by a red run.
- Verified: the existing jsdom tests assert only which Theme wraps the card (
useToast.test.tsx:235-265). - Verified: the description's paraphrases of the theme-application invariant, the host-rewrite rule before it, and Toast's contrast requirement with its 4.5:1 check match the current records, and no record changes.
- Verified: the story pins the toolbar theme to none, so no
LayerProvideris above it and both toasts use the fallback viewport (.storybook/preview.tsx:70-83). - Verified: the spec waits for the page Theme and Storybook's root color scheme, then themes the root as a host does (spec lines 79-97).
- Verified: the spec checks the card's Theme, its radius from that Theme's tokens and its text contrast under a light and a dark host, with both story Themes light (spec lines 157-170).
- Verified: with the caller's Theme removed, all 4 cases fail on all three checks (
host, 12px, 1.0:1 and 1.3:1). - Verified: all 4 cases pass in 3 runs in a row against
main's Toast and theme code, and again in CI on this head after the merge ofmain. - Verified: no shipped file, workflow or CI script changes; the spec-routing helper finds the spec through the Toast folder, and the scope line runs it for Toast, theme and Toast-story changes.
- Verified: no public API, behavior or policy change, and no internal context in the pull request text, commits or code.
- Verified: 223 authored lines and a clean merge into
main; the pre-review command reported 0 findings on this patch. apps/storybook/stories/Toast.stories.tsx: clear.packages/core/src/Toast/__tests__/ToastFallbackTheme.a11y.chromium.spec.ts: clear.
Maintainer impact
The fallback toast viewport draws a toast under the Theme it was shown from (#12716). The defect behind that rule was toast text nobody could read: 1.0:1 to 1.3:1 in a page whose host renamed the theme on the root element.
The tests for the rule run in jsdom. jsdom applies no scoped theme CSS and paints nothing, so they prove which Theme wraps the card. They do not prove that the Theme's tokens reach the card or what color its text paints. A change that keeps the wrapper and breaks the cascade passes today.
Intended invariant
architecture:theme-applicationINV3: a toast in the fallback toast viewport draws under the nearest Theme of the component that showed it. The record's text before INV3 adds that a host page that rewrites<html>does not change that theme.component:ToastFR14: toast text takes the color that reads best on its painted card. Its verification measures WCAG 2.2 SC 1.4.3 (4.5:1).This pull request changes neither. It adds the real-engine evidence for both in the fallback viewport.
Change
Core/Toast/Accessibility / Fallback viewport under a Theme: a page Theme with--radius-container: 0px, a second Theme with24pxaround one region, and one button in each. The story sets the toolbar theme to none, so noLayerProvideris above it and both toasts go to the fallback viewport.ToastFallbackTheme.a11y.chromium.spec.ts. It opens the story, waits for the page Theme to name itself on the root element and for Storybook's own inline root color scheme, then themes the root as a host does: a theme name the page holds no CSS for, a scheme, and the host's own text and inverted-surface colors. It shows a toast from each button and checks three things on the card: the Theme around it, its corner radius from that Theme's tokens (0pxor24px), and its text contrast. It runs under a light and a dark host; both story Themes are light.No file that ships in a package changes. No record changes:
pnpm specs:forfinds the spec through the Toast folder.Evidence
useToast.tsxremoved), all 4 cases fail on all three checks. The card's theme ishost, its radius is the default12pxinstead of0pxor24px, and the contrast is 1.0:1 under a light host and 1.3:1 under a dark host.main, all 4 cases pass in Chromium in 3 runs in a row (about 18 s for the file, including the Storybook server).@pr-a11y scopeline runs it when a pull request changes Toast,theme/or the Toast stories.Scope
Components: Toast
Testing
pnpm review:prereports 0 findings, 223 authored lines and a clean merge intomain.