Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
… contrast specs per theme; keep caller MediaTheme
|
/approve-spec 63e5d50 |
There was a problem hiding this comment.
Changes requested. The media-side wrapper makes Text tooltip content readable in every shipped theme, from about 1:1 to at least 5.75:1, and an engineering owner approved that direction for this head. Four things still need fixing before it lands.
- The plain-string text color change and the lost
tooltip-targetcolorship without their record, so restore thecomponent:TooltipDesign relationships amendment (with a theming-map note for text color) and have an engineering owner approve the new head; wrapping only element content would keep plain strings on--color-background-surfaceand shrink that amendment to element content. - Found by CI: wrapping plain strings breaks five existing tests (
anchorReadiness.a11y.browser.spec.ts:101,:128and:273, whose tooltip text now sits in a boxlessdisplay: contentsdiv;DialogHeroHeader.test.tsx:161, which now finds the Close button's tooltip as a media surface; andPagination.test.tsx:2579, where Next turns back into a link about 120 ms late), and wrapping only element content atuseTooltip.tsx:1041makes the two Vitest files andTooltip.mediaTheme.test.tsxpass. - The new
TooltipContentContrast.a11y.chromium.spec.tsfails in CI in six of seven themes, because secondaryTextis under 4.5:1 at rest in Gothic (2.32:1) and Matcha dark (3.46:1) and because the spec measures during the tooltip's entrance fade, so callholdMotionStill(page)aftergotoand fix those two themes' secondary text or narrow the secondary case and the "every kind of content reads" claim. useTooltip.tsx:103-121copies Toast's token-then-mode side fallback (Toast.tsx:428-450), so extend the shareduseSurfaceMediaModeto take that fallback and have Toast and Tooltip each make one call.
Claims and files checked
Review mode: same-head; reason: none
Claims:
- On the base,
Textcontent measures about 1:1 against the tooltip surface in light and dark: verified, 1.00:1 to 1.12:1 in all seven shipped themes. - After the change, every kind of content reads on the tooltip surface in both modes: false. Secondary
Textmeasures 2.32:1 in Gothic and 3.46:1 in Matcha dark at rest. - Content renders inside a
MediaThemeon the side whose text reads best, measured the way Toast measures: verified atuseTooltip.tsx:92-123. - Before a measurement, the side comes from the resolved inverted-surface token, and otherwise from the color mode: verified at
useTooltip.tsx:103-121and by the unit test with an unreadable surface color. - The surface's own text color never turns the media context off: verified;
useTooltip.tsx:74-79passes no ambient color. - The wrapper renders only inside the layer and measures only while the tooltip shows: verified at
useTooltip.tsx:1045(isShown={isLayerOpen}). - Content that already holds a
MediaThemekeeps it and gets no second wrapper: verified for a top-levelMediaTheme(useTooltip.tsx:1041, unit test). - Every component that renders a tooltip through
useTooltipgets the fix: verified; 25 component folders calluseTooltip, more than the 20 stated. - No new prop, export or data attribute: verified; the built API comparison and CI's API report list no changes.
- No record change: true, but the shipped behavior contradicts the unamended record (first finding).
- No change to the surface color, size, padding, layer behavior or docs example: verified.
- Neutral stills:
Textcontent 1.12:1 and 1.00:1 before, 18.78:1 and 18.88:1 after, and dark plain text from rgb(38, 38, 38) to rgb(17, 17, 17): verified in Chromium at rest. - Four new unit tests fail without the wrapper and pass with it, and a fifth checks a caller
MediaTheme: verified. - The Chromium contrast spec proves 4.5:1 text and 3:1 icons in every shipped theme: false; it fails in CI in six of seven themes (third finding).
- Typecheck and lint pass: verified; both are green in CI at this head.
- Changeset:
Textcontent is readable and renders inside aMediaThemeas Toast's content does: verified. Plain-text tooltips can differ slightly from their old color: verified, with larger moves in some themes (Matcha dark 10.13:1 to 5.75:1).
Files:
.changeset/tooltip-content-media-theme.md: clear.apps/storybook/stories/Tooltip.stories.tsx: clear. Its secondary case is the one the spec fails on at rest in Gothic and Matcha dark.packages/core/src/Tooltip/Tooltip.mediaTheme.test.tsx: clear.packages/core/src/Tooltip/__tests__/TooltipContentContrast.a11y.chromium.spec.ts: fails in CI (third finding).packages/core/src/Tooltip/useTooltip.tsx: wrapping plain strings contradicts the record and breaks five tests (first and second findings); copied Toast fallback (fourth finding); the comment at lines 69-73 gives the wrong reason (non-blocking).
…xt color; Gothic and Matcha secondary text reads on light media Tooltip content now sits in MediaTokens, an internal MediaTheme form that sets the media side's tokens and no text color. Text and other token-colored content read on the surface, and inherited text, plain or beside other elements, keeps the tooltip target's color as before. Toast and Tooltip take their side from one shared hook, useInvertedSurfaceMediaMode, with the token-then-mode fallback. Gothic and Matcha secondary text on a light media surface is darker, so it reaches 4.5:1 on their tooltips. The record states that inherited text keeps the surface color.
|
/approve-spec 80b6792 |
There was a problem hiding this comment.
Changes requested. The media-side tokens make Text tooltip content readable in every shipped theme (from about 1:1 to at least 4.80:1 at rest) while plain text keeps its color, and an engineering owner approved the record change for this head; three small fixes remain.
- Wrapping plain strings in
MediaTokensstill breaks five existing tests (DialogHeroHeader.test.tsx:161,Pagination.test.tsx:2579, andanchorReadiness.a11y.browser.spec.ts:101,:128and:273), so render string and number content without the wrapper atuseTooltip.tsx:1021, which makes all five pass. - The new
TooltipContentContrast.a11y.chromium.spec.tsfails in all seven shipped themes because it measures during the tooltip's entrance fade, so callholdMotionStill(page)after eachpage.goto, which makes it pass in every theme. - The changeset names only
@astryxdesign/core, so also name@astryxdesign/theme-gothicand@astryxdesign/theme-matcha, whose secondary text on light media surfaces changes.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- On the base,
Textcontent reads about 1:1 on the tooltip surface: verified, 1.00:1 to 1.12:1 in all seven themes and both modes. - After the change,
Textcontent reads in every shipped theme and mode, and plain text looks exactly as before: verified at rest, 4.80:1 or more, with plain-text colors identical in all 14 pairs. - Content gets the tokens of the side that reads on the painted surface, as Toast's does, from the measurement, then the resolved surface token, then the color mode: verified (
useAutoMediaMode.ts:146-172,useTooltip.tsx:78-103, the unresolvable-surface unit test). - Content does not take MediaTheme's text color, so inherited text and a theme's
tooltipcolor still reach it: verified (MediaTheme.tsx:117-137; the probe theme's tooltip color reaches plain text; the bare-text test passes). - The wrapper renders only inside the open layer and measures only while the tooltip shows: verified (
useTooltip.tsx:1025). - Content that already holds a
MediaThemekeeps its own: verified for a top-levelMediaTheme(useTooltip.tsx:1021, unit test). - No new prop, export or data attribute, and the new component and hook stay internal: verified; the built API comparison lists no changes.
- Toast makes one call to the shared hook and behaves as before: verified; same fallback order, and its tests and text-contrast check pass.
- Gothic and Matcha secondary text on their light tooltip surfaces fell below 4.5:1 (2.32:1 and 3.46:1) and now reads 5.04:1 and 5.75:1, and no lighter stop reaches 4.5:1: verified (the next lighter stops read 4.29:1 and 4.47:1).
- The record's Tooltip text row now describes the media tokens and the kept surface color: verified, and approved for this head.
- The before-and-after stills table: verified; every ratio matches at-rest Chromium measurements.
- Four new unit tests fail without the wrapper and a fifth keeps a caller
MediaTheme: verified on the base (4 fail, 1 passes). - The Chromium contrast spec proves 4.5:1 text and 3:1 icons in every shipped theme: false as written; it fails in all seven themes at this head (second finding).
- The listed Vitest folders, typecheck, lint, the knowledge check and the palette-reference checks pass: verified; two existing Vitest files outside those folders fail (first finding).
- The overlap list and the origin of the approach describe other work, not this code: context only.
- Changeset:
Textcontent becomes readable, plain text keeps the tooltip's color, and Gothic and Matcha secondary text reaches 4.5:1 on light inverted surfaces: verified; it releases only Core (third finding).
Files:
.changeset/tooltip-content-media-theme.md: names only Core (third finding).apps/storybook/stories/Tooltip.stories.tsx: clear.docs/specs/components/Tooltip/Tooltip.spec.md: clear; owner-approved for this head.packages/core/src/Toast/Toast.tsx: clear.packages/core/src/Tooltip/Tooltip.mediaTheme.test.tsx: clear.packages/core/src/Tooltip/__tests__/TooltipContentContrast.a11y.chromium.spec.ts: measures mid-fade (second finding).packages/core/src/Tooltip/useTooltip.tsx: plain-string wrapper (first finding).packages/core/src/hooks/useAutoMediaMode.ts: clear.packages/core/src/theme/MediaTheme.tsx: clear.packages/themes/gothic/src/gothicTheme.ts: clear; needs its release note (third finding).packages/themes/matcha/src/matchaTheme.ts: clear; needs its release note (third finding).
…pper; the contrast spec measures at rest Plain text reads no tokens, so a string or number tooltip renders the same DOM as before. The contrast spec holds motion still after each load, so it measures the settled colors, not the entrance fade. The changeset names the Gothic and Matcha packages.
|
/approve-spec 805e5f9 |
There was a problem hiding this comment.
Changes requested. The media-side tokens now make Text tooltip content readable in every shipped theme (from about 1:1 to at least 4.80:1 at rest), plain strings render exactly as before, the five previously broken tests and the new contrast spec pass, and the changeset names both theme packages; one false claim remains.
- Miss: the description and the comment at
useTooltip.tsx:82-85say a tooltip that never shows pays nothing forTooltipMediaContent, but the tooltip layer is not lazy and mounts the wrapper with the closed tooltip (the never-hoveredTallContentstory already has adata-astryx-mediawrapper inside its closed tooltip), so reword both or render the wrapper only once the layer has opened.
Non-blocking: the comment at matchaTheme.ts:358-359 calls neutral.light[20] the darkest neutral, but it is the lightest stop that reaches 4.5:1 there.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- On the base,
Texttooltip content reads about 1:1 on the surface: verified, 1.00:1 to 1.12:1 in all seven themes and both modes. - Plain-string content was readable on the base: verified, 9.77:1 to 18.78:1.
- After the change,
Textcontent reads in every shipped theme and mode, and plain text looks exactly as before: verified at rest, 4.80:1 or more, with plain-string colors identical and unwrapped in all 14 pairs. - The tooltip paints the inverted surface and gives its own text the page surface color: verified (
useTooltip.tsx:108-109). - Content gets the side that reads on the painted surface, as Toast's does, from the measurement, then the resolved surface token, then the color mode: verified (
useAutoMediaMode.ts:146-172, the four media unit tests). - Content does not take MediaTheme's text color, so inherited text and a theme's
tooltipcolor still reach it: verified (MediaTheme.tsx:117-137; the probe theme's tooltip color reaches the plain and bare text; the bare-text test passes). - The cited Tooltip, accessibility, theming and MediaTheme references say what the description says: verified.
MediaTokensand the new hook stay internal: verified; no package entry reaches them.- Toast and Tooltip each call the shared hook once, and Toast behaves as before: verified (
Toast.tsx:424,useTooltip.tsx:97; same fallback order). - String and number content renders with no wrapper, other content gets the media wrapper, and content that holds a
MediaThemekeeps its own: verified (useTooltip.tsx:1021-1031, unit test). - The wrapper renders only after the tooltip first shows, so a tooltip that never shows pays nothing: false (finding above); it does measure only while the tooltip shows.
- Gothic and Matcha secondary text on their light tooltip surfaces fell below 4.5:1 and now reads 5.04:1 and 5.75:1, with no lighter passing stop: verified (the next lighter stops read 4.29:1 and 4.47:1).
- The record's Tooltip text row describes the media tokens and the kept surface color: verified, and approved for this head.
- No new prop, export or data attribute: verified; the built API comparison lists no change.
- The before-and-after stills: verified; every ratio matches at-rest Chromium measurements.
- Plain-string and number content renders as on the base: verified in Chromium for strings and in code for numbers.
- The theme change reaches other light media surfaces with the listed Toast and panel ratios: verified from the built theme CSS and the same color pairs measured on the tooltip surface.
- Four unit tests fail without the wrapper and a fifth keeps a caller
MediaTheme: verified on the base (4 fail, 1 passes). - The Chromium contrast spec measures at rest in every shipped theme and also checks bare-text color: verified; 14 of 14 pass.
- The listed Vitest folders pass (16 files, 358 tests), with typecheck, lint, the knowledge check and the palette checks: verified.
- The contrast spec runs in the pull request accessibility job: verified that the job's routing selects it; CI has not run on this head.
- The scope checklist (one defect, no tag-along, no hidden API, no internal context): verified.
- The overlap list and the origin of the approach: context only.
- Changeset:
Textcontent becomes readable, plain and bare text keep the tooltip's color, Gothic and Matcha light-media secondary text reaches 4.5:1, and core, theme-gothic and theme-matcha are named: verified.
Files:
.changeset/tooltip-content-media-theme.md: clearapps/storybook/stories/Tooltip.stories.tsx: cleardocs/specs/components/Tooltip/Tooltip.spec.md: clearpackages/core/src/Toast/Toast.tsx: clearpackages/core/src/Tooltip/Tooltip.mediaTheme.test.tsx: clearpackages/core/src/Tooltip/__tests__/TooltipContentContrast.a11y.chromium.spec.ts: clearpackages/core/src/Tooltip/useTooltip.tsx: finding (comment at 82-85)packages/core/src/hooks/useAutoMediaMode.ts: clearpackages/core/src/theme/MediaTheme.tsx: clearpackages/themes/gothic/src/gothicTheme.ts: clearpackages/themes/matcha/src/matchaTheme.ts: non-blocking comment suggestion
The wrapper renders with the tooltip content, also while the tooltip is closed, and measures only while it shows. The Matcha comment names the lightest neutral stop that reaches 4.5:1.
|
/approve-spec f9d7d99 |
There was a problem hiding this comment.
Approved pending CI: the CI run on this head stopped because CI was full before its tests ran, so re-run all jobs and let the required checks finish. Tooltip content built from Text now reads on the tooltip surface in every shipped theme and mode (from about 1:1 to at least 4.80:1 at rest), and plain strings render exactly as before.
No blocking findings; nothing for the author to change.
Claims and files checked
Review mode: same-head; reason: none
changed rules (0): none
Claims:
- On the base,
Texttooltip content reads about 1:1 on the surface: verified, 1.00:1 to 1.12:1 in all seven themes and both modes. - Plain-string content was readable on the base and is not affected: verified, 9.77:1 to 18.78:1, with the same colors on the head.
- After the change,
Textcontent reads in every shipped theme and mode, and plain text looks exactly as before: verified at rest, 4.80:1 or more, with plain-string colors identical and unwrapped in all 14 pairs. - The tooltip paints the inverted surface and gives its own text the page surface color: verified (
useTooltip.tsx:107-108). - Content gets the side that reads on the painted surface, as Toast's does, from the measurement, then the resolved surface token, then the color mode: verified (
useAutoMediaMode.ts:146-172, the four media unit tests). - Content does not take MediaTheme's text color, so inherited text and a theme's
tooltipcolor still reach it: verified (MediaTheme.tsx:123-137; bare text beside an element keeps the tooltip's color). - The cited Tooltip, accessibility, theming and MediaTheme references say what the description says: verified; the MediaTheme docs name tooltips as an inverted surface it serves.
MediaTokensand the new hook stay internal: verified; no package entry reaches them.- Toast and Tooltip each call the shared hook once, and Toast behaves as before: verified (
Toast.tsx:424,useTooltip.tsx:95; same fallback order). - String and number content renders with no wrapper, other content gets the media wrapper, and content that holds a
MediaThemekeeps its own: verified (useTooltip.tsx:1020-1030, unit test). - The wrapper renders with the tooltip content while the tooltip is closed and measures only while it shows: verified (the never-hovered
TallContenttooltip holds it; the measurement is gated on the open layer). - Gothic and Matcha secondary text on their light tooltip surfaces fell below 4.5:1 and now reads 5.04:1 and 5.75:1, with no lighter passing Matcha stop: verified; Matcha's stop is also its primary text on light media surfaces.
- The record's Tooltip text row describes the media tokens and the kept surface color: verified, and approved for this head.
- No new prop, export or data attribute: verified; the built API comparison and CI's API report list no change.
- The before-and-after stills: verified; every ratio matches at-rest Chromium measurements.
- Plain-string and number content renders as on the base: verified in Chromium for strings and in code for numbers.
- The theme change reaches other light media surfaces with the listed Toast and panel ratios: verified from the built theme CSS and the same color pairs.
- Four unit tests fail without the wrapper and a fifth keeps a caller
MediaTheme: verified on the base (4 fail, 1 passes). - The Chromium contrast spec measures at rest in every shipped theme and also checks bare-text color: verified; 14 of 14 pass on code identical to this head apart from two comments.
- The listed Vitest folders pass (16 files, 358 tests), with typecheck, lint, the knowledge check and the palette checks: verified; CI's lint job also passes on this head.
- The contrast spec runs in the pull request accessibility job: verified that the job's routing selects it; that job has not run on this head yet.
- The scope checklist (one defect, no tag-along, no hidden API, no internal context): verified.
- The overlap list, the build used for the stills and the origin of the approach: context only.
- Changeset:
Textcontent becomes readable, plain and bare text keep the tooltip's color, Gothic and Matcha light-media secondary text reaches 4.5:1, and core, theme-gothic and theme-matcha are named: verified.
Files:
.changeset/tooltip-content-media-theme.md: clearapps/storybook/stories/Tooltip.stories.tsx: cleardocs/specs/components/Tooltip/Tooltip.spec.md: clearpackages/core/src/Toast/Toast.tsx: clearpackages/core/src/Tooltip/Tooltip.mediaTheme.test.tsx: clearpackages/core/src/Tooltip/__tests__/TooltipContentContrast.a11y.chromium.spec.ts: clearpackages/core/src/Tooltip/useTooltip.tsx: clearpackages/core/src/hooks/useAutoMediaMode.ts: clearpackages/core/src/theme/MediaTheme.tsx: clearpackages/themes/gothic/src/gothicTheme.ts: clearpackages/themes/matcha/src/matchaTheme.ts: clear
There was a problem hiding this comment.
Approval now waits on an engineering owner deciding the first-load cost of this fix. The fix itself works: Text content in a Tooltip reads at 4.80:1 or more in every shipped theme and mode, and plain strings render as before.
- Miss:
useTooltipnow importsMediaThemeanduseInvertedSurfaceMediaMode, and theiruseTheme()call brings in the theme token resolver, so every page that imports Button, IconButton, Link, Table, CheckboxList, Selector or DropdownMenu loads about 10 KB more gzip JavaScript at first load (+11.9 to +12.2 KB on each of the four reference pages inpnpm size:pages), which earlier approvals of this head did not report.
An engineering owner answers in a comment on this pull request, choosing one: accept the cost and update the INV1 gap figures in docs/architecture/component-import-boundaries.md, or keep the tooltip content's media-side code out of the eager import, for example by loading it after first paint as DEC-4 describes; the author may answer if they are an engineering owner. Separately, pr-interaction-webkit failed because a starved runner disrupted a Toast touch test, so re-run it.
Claims and files checked
Review mode: same-head; reason: none
changed rules (0): none
Claims:
- On the base,
Textcontent in a tooltip reads about 1:1 on the surface: verified, 1.00:1 to 1.12:1 in all seven themes and both modes. - Plain-string content was readable on the base and is not affected: verified, with the same element and color on the head.
- After the change,
Textcontent reads in every shipped theme and mode, and plain text looks the same: verified, 4.80:1 or more; the Chromium contrast spec passes in CI on this head. - The tooltip paints the inverted surface and gives its own text the page surface color: verified in the tooltip's styles.
- The content's side comes from the measurement, then the resolved surface token, then the color mode, as Toast's does: verified in the shared hook and the four media unit tests.
- The content does not take MediaTheme's text color, so a theme's
tooltipcolor still reaches plain and bare text: verified; the bare-text check passes in every theme in CI. - The cited Tooltip, accessibility, theming and MediaTheme references say what the description says: verified.
- The new wrapper and hook stay internal, and there is no new prop, export or data attribute: verified; no package entry reaches them.
- Toast and Tooltip each call the shared hook once, and Toast behaves as before: verified; the calls are the same and in the same order.
- String and number content renders with no wrapper, and content that holds a
MediaThemekeeps its own: verified in the code and a unit test. - The wrapper renders with the closed tooltip and measures only while the tooltip shows: verified.
- Gothic and Matcha light-media secondary text went from 2.32:1 and 3.46:1 to 5.04:1 and 5.75:1, and Matcha's stop is also its primary text there: verified.
- The record's Tooltip text row describes the media tokens and the kept surface color: verified, and approved by an engineering owner for this head.
- The before-and-after stills and their ratios: verified against at-rest Chromium measurements.
- The theme change reaches other light media surfaces with the listed Toast and panel ratios: verified.
- Four unit tests fail without the wrapper, and a fifth keeps a caller
MediaTheme: verified on the base Tooltip. - The listed unit tests, typecheck, lint and the knowledge and palette checks pass: verified; CI's typecheck, UI unit tests and lint pass on this head.
- The contrast spec runs in the accessibility job: verified; it ran and passed on this head.
- The scope checklist (one defect, no tagalong, no hidden API, no internal context): verified. The first-load cost is a separate open decision.
- The overlap list, the build used for the stills and the origin of the approach: context only.
- Changeset: the fix and the Gothic and Matcha stops are described, and core, theme-gothic and theme-matcha are named: verified.
Files:
.changeset/tooltip-content-media-theme.md: clearapps/storybook/stories/Tooltip.stories.tsx: cleardocs/specs/components/Tooltip/Tooltip.spec.md: clear (row approved for this head)packages/core/src/Toast/Toast.tsx: clearpackages/core/src/Tooltip/Tooltip.mediaTheme.test.tsx: clearpackages/core/src/Tooltip/__tests__/TooltipContentContrast.a11y.chromium.spec.ts: clearpackages/core/src/Tooltip/useTooltip.tsx: owner decision on the first-load cost of its new importspackages/core/src/hooks/useAutoMediaMode.ts: part of that cost (itsuseTheme()calls)packages/core/src/theme/MediaTheme.tsx: clearpackages/themes/gothic/src/gothicTheme.ts: clearpackages/themes/matcha/src/matchaTheme.ts: clear
…not 12 KB The tooltip content media context read useTheme(), whose token resolver pulled the theme generator into every page that renders a tooltip. Now: - the media side measurement keys on the nearest Theme value, not the resolved tokens, and loads after the first paint; - before a measurement, the side is the one opposite the color mode, as the inverted surface is in every shipped theme; - MediaTokens has its own module, so the wrapper does not pull in MediaTheme and its auto mode. The CLI theme bundle is regenerated for the Gothic and Matcha changes.
|
/approve-spec 22494e5 |
main reworked Toast's media side (it now picks the side for a light and a dark page before it measures), so Toast.tsx takes main's file. This branch's useInvertedSurfaceMediaMode, which only Toast used, is dropped; the measurement still keys on the nearest Theme value.
|
/approve-spec fc6ef3b |
There was a problem hiding this comment.
Changes requested. Tooltip content built from Text now reads on the tooltip surface once its side is measured (4.80:1 or more in Neutral, Gothic and Matcha, light and dark), and plain strings render as before; the blocking findings below remain.
TooltipMediaContent.tsx:76-81picks the pre-measurement side from the raw Thememodeprop, so under the defaultmode="system"in a dark scheme, and in Gothic (whose tooltip surface is light in both modes),Textcontent paints at 1.00:1 until the measurement chunk arrives; take the side from the theme's resolved inverted surface by the measurement's rule, as Toast does.useAutoMediaMode.ts:146keys the shared measurement on the Theme context instead ofuseTheme(), so under amode="system"ThemeMediaTheme mode="auto"no longer re-measures when the reader's color scheme changes and keeps the old side; key it on the resolved scheme as well, for example by exporting the lightuseResolvedSchemefromtheme/useTheme.ts.theme/MediaTokens.tsxis a new internal module imported fromTooltip/that no record defines: move it intoTooltip/, or record its usage, why it is needed and whyMediaThemeis not enough for an owner decision.- The layout Effect at
tooltipSurfaceSide.tsx:50-52only copies the measured side into the parent's state; report it from the measurement's own layout Effect through a callback instead. - The module-load Effect at
TooltipMediaContent.tsx:59-75repeats the two inText/TruncationTooltip.tsx(:79-95,:312-328); share one hook besidecreateModuleLoader. - The description says the pre-measurement side comes from the theme's resolved surface (it comes from the mode prop), that the inverted surface is opposite the color mode in every shipped theme (not in Gothic), that a scheme change re-measures (it does not under a system Theme), that four unit cases fail without the wrapper (three do), and that a cold first show has no flash (it reads 1.00:1 in the two cases above).
Non-blocking: record Gothic's new light-media secondary stop (neutral.dark[50], 5.04:1 on its tooltip) in gothic.spec.md beside the accent line.
Claims and files checked
Review mode: same-head; reason: none
- Claim:
Textcontent in a tooltip reads at 4.5:1 or more: verified once measured (4.80:1 or more in Neutral, Gothic and Matcha, light and dark); false before the measurement under a dark system scheme and in Gothic. - Claim: plain strings and numbers render as before: verified (
useTooltip.tsx:979-981; the same ratio as the base in every pair). - Claim: inherited and bare text keep the
tooltipsurface color: verified (MediaTokens.tsx:36-42sets no color; bare text matches the plain string in every pair). - Claim: before the measurement the side comes from the theme's resolved surface color: false (
TooltipMediaContent.tsx:76-81reads the mode prop). - Claim: the side opposite the color mode matches the inverted surface in every shipped theme: false for Gothic.
- Claim: a scheme change re-measures through the painted backdrop: false under a system Theme (
useAutoMediaMode.ts:146). - Claim: Toast is unchanged: verified (the pull request does not edit Toast, which still calls
useTheme()itself). - Claim: the wrapper has its own module so the tooltip does not load
MediaTheme: verified (TooltipMediaContent.tsx:23). - Claim: the measurement loads after the first paint and corrects the side before the shown frame paints: verified once loaded (layout Effects).
- Claim: a
MediaThemeinside the content keeps its own side: verified (its own marker is the nearest to the text). - Claim: the CLI theme copies are regenerated: verified, byte-identical to the package sources.
- Claim: Gothic and Matcha light-media secondary text reaches 5.04:1 and 5.75:1: verified in Chromium.
- Claim: Matcha's new secondary stop is also its light-media primary text: verified (
--color-on-light). - Claim: the Tooltip record's Tooltip text row states the new behavior: verified; an engineering owner approved this head.
- Claim: no new prop, export or data attribute: verified (no entry point reaches the new modules;
data-astryx-mediaalready exists). - Claim:
Textcontent measures 1.00:1 to 1.12:1 on the base: verified in Chromium. - Claim: four new unit cases fail without the wrapper: false; three do, since the
MediaThemecase brings its own marker. - Claim: the Chromium contrast spec covers every shipped theme: not run in CI at this head (draft); its assertions hold in Chromium for Neutral, Gothic and Matcha.
- Claim: the before and after stills: verified for Neutral, Gothic and Matcha.
- Claim: Gothic and Matcha Toast cards and panels improve the same way: consistent with the shared token; not measured separately.
- Claim: per-component first-load deltas of 370 to 1,072 bytes: not re-measured per component.
- Claim: a cold first show has no flash: false under a dark system scheme and in Gothic.
- Claim: the listed unit suites pass: verified for the Tooltip, Toast, MediaTheme, media-measurement and truncation-tooltip suites (15 files, 312 tests at this head); the DialogHeroHeader, Pagination, InfoTip and CLI theme-bundle suites were not re-run.
- Changeset: names Core, Gothic and Matcha as patches and describes the fix: verified, apart from the pre-measurement cases.
- Files:
TooltipMediaContent.tsx(findings),tooltipSurfaceSide.tsx(finding),useTooltip.tsx(clear),useAutoMediaMode.ts(finding),MediaTokens.tsx(finding),gothicTheme.tsand its CLI copy (owner-approved; comment suggestion),matchaTheme.tsand its CLI copy (clear),Tooltip.mediaTheme.test.tsx(clear),TooltipContentContrast.a11y.chromium.spec.ts(clear),Tooltip.stories.tsx(clear),Tooltip.spec.md(clear, owner-approved), the changeset (clear).
| // The nearest Theme's value is a stable reference unless its theme or mode | ||
| // changes. A change of the page's scheme moves the painted backdrop, which | ||
| // the key below also holds. | ||
| const themeKey = use(ThemeContext); |
There was a problem hiding this comment.
Under a mode="system" Theme this context value is the raw prop, memoized on theme and mode (Theme.tsx:481-484), so it does not change when the reader switches scheme. The base's useTheme() call was also this hook's subscription to the scheme (useResolvedScheme), so now nothing re-renders MediaTheme mode="auto" and it keeps the old side: an inverted panel's text goes white on white (1.00:1), where the base re-measures. Key the measurement on the resolved scheme as well, for example by exporting useResolvedScheme from theme/useTheme.ts, which does not bring in resolveThemeTokens.
| const mode = | ||
| measured === 'dark' || measured === 'light' | ||
| ? measured | ||
| : theme?.mode === 'dark' | ||
| ? 'light' | ||
| : 'dark'; |
There was a problem hiding this comment.
theme?.mode is the Theme's raw prop, 'system' by default, so a dark system scheme gets the dark side on the white dark-mode surface: Text is white on white (1.00:1) until the measurement arrives. Gothic's surface is #e8f1f6 in both modes, so under system or light the same side paints Text in the surface's color (1.00:1). Take the side from the theme's resolved inverted surface by the measurement's rule, as Toast does with invertedSideIn (Toast.tsx:433-437).
| * tokens, such as `Text`, take the side's values, and inherited text keeps | ||
| * the color of the surface around it. | ||
| */ | ||
| export function MediaTokens({ |
There was a problem hiding this comment.
This is a new internal module that Tooltip/TooltipMediaContent.tsx imports from another folder, and no current record names it (architecture:knowledge-contracts DEC-22). Move it into Tooltip/, where it is private, or record its usage, why it is needed, and why MediaTheme (which differs only by setting color) is not enough, for an owner decision.
| // Syncs the measured side with the content's media context. | ||
| useIsomorphicLayoutEffect(() => { | ||
| onSide(side); | ||
| }, [side, onSide]); |
There was a problem hiding this comment.
This layout Effect only copies side into the parent's state (onSide is setMeasured), which architecture:react-component-runtime INV1 and INV2 rule out. Report the side from the measurement's own layout Effect, where useAutoMediaMode.ts:190 already sets it, for example through an optional callback on useSurfaceMediaMode.
| // Syncs with the module loader: element content loads the measurement. | ||
| useEffect(() => { | ||
| if (SurfaceSide != null) { | ||
| return; | ||
| } | ||
| let isCurrent = true; | ||
| surfaceSideModule.load().then( | ||
| loaded => { | ||
| if (isCurrent) { | ||
| setSurfaceSide(() => loaded.TooltipSurfaceSide); | ||
| } | ||
| }, | ||
| () => {}, | ||
| ); | ||
| return () => { | ||
| isCurrent = false; | ||
| }; | ||
| }, [SurfaceSide]); |
There was a problem hiding this comment.
This repeats the two load Effects in Text/TruncationTooltip.tsx (:79-95, :312-328) line for line. Add one hook beside createModuleLoader in utils/moduleLoader.ts that returns the loaded module or null, and call it from all three.
| // Gothic's secondary text is one light color too, so a light media surface | ||
| // takes a darker one that reads on it. |
There was a problem hiding this comment.
Non-blocking: "one light color too" does not say why the stop changes. Suggested:
// On a light media surface, the page's secondary text falls below 4.5:1.
// This stop reads at 5.04:1 there.
User impact
An app that puts
Text(or another token-colored component) in a Tooltip'scontent, as the Tooltip docs show, gets an empty-looking tooltip. The text takes the page theme's primary text color, which is the same color as the tooltip's inverted surface, so the contrast is 1:1 in light and dark. Readers who hover or focus the trigger see a blank box. Plain-string content is not affected. After this change,Textcontent reads on the tooltip surface in every shipped theme in both modes, and plain text looks exactly as before.Problem and solution fit
--color-background-invertedand gives its own text--color-background-surface. The supplied content renders straight into that surface with no media context.Textsets its own color from--color-text-primary, and that token still resolves against the page theme, which gives the color of the surface.Textcontent, they are invisible, and the docs example is that case.The fix gives the content the tokens of the media side that reads on the painted surface, as Toast's content already gets them. Before the measurement (on the server and in the first frame), the side comes from the theme's resolved inverted surface color, and otherwise from the color mode. The content does not take MediaTheme's own text color: inherited text, a plain string or bare text beside other elements, keeps the
tooltipsurface's color, so a theme'stooltipcolor still reaches it. This approach comes from the root cause given in the original report.Expected behavior and authority
component:TooltipFR1: the content renders on the owned inverted surface. Its Design relationships row states the surface's text color, which inherited text keeps.spec:AST-020FR1 (WCAG 1.4.3 text contrast) for the content on that surface.architecture:theme-applicationINV8 (a media surface changes local tokens only) and theMediaThemedocs, which name tooltips as an inverted surface it serves. Toast's content already renders this way.Smallest restoration
theme/MediaTokens.tsx: an internalMediaTokenscomponent (not exported from the package). It sets a media side's tokens without MediaTheme's text color. It has its own module, so the tooltip does not load MediaTheme and its auto mode.hooks/useAutoMediaMode.ts: the shared measurement re-measures when the nearest Theme value changes, instead of reading the resolved tokens. A scheme change also moves the painted backdrop, which the measurement already compares. Toast is unchanged:main's Toast picks its own side before it measures.Tooltip/useTooltip.tsx: string and number content renders as before, with no wrapper. Other content renders inside a small internalTooltipMediaContent(Tooltip/TooltipMediaContent.tsx), which rendersMediaTokens:Tooltip/tooltipSurfaceSide.tsx) loads after the first paint, measures the painted surface when the tooltip shows, and corrects the side before that frame paints.MediaThemeinside the content sets its own side for what it holds.pnpm bundle:cli-themes).onLighttokens), because their light-mode secondary text falls below 4.5:1 on their tooltip surface (Gothic 2.32:1, Matcha dark 3.46:1). Gothic uses its existingneutral.dark[50](5.04:1). Matcha usesneutral.light[20](5.75:1); it is also Matcha's primary text color on a light media surface, because no lighter stop reaches 4.5:1 there.component:Tooltip: the Tooltip text row says that content reads the media side's tokens and inherited text keeps the surface color.Evidence
<Text type="body">content measures 1.00:1 to 1.12:1 onmainin every theme and mode below.Textreach at least 4.80:1, and plain strings keep their exact color and ratio frommain.Tooltip.mediaTheme.test.tsxasserts the media side aroundTextcontent under dark, light and unresolvable surfaces (four cases fail without the wrapper) and that a callerMediaThemeis kept.TooltipContentContrast.a11y.chromium.spec.tsopens theRichContentstory in every shipped theme, light and dark, and requires 4.5:1 for every text run and 3:1 for the icon, measured with motion held still so the entrance fade is over; a second test requires a plain string and bare text beside an element to keep thetooltipsurface's color.Chrome stills (
mainvs this head)Headless Chrome 157 on Linux, a production Vite build of Core from source at
main(96687ea2fb) and at this head. Each tooltip holds the docs'<Text type="body">example, a secondaryText, or a plain string. Each ratio is measured in the page: the text's computed color against the tooltip surface's computed background.mainbody 1.12:1, secondary 2.02:1, plain 18.78:1
body 18.78:1, secondary 7.01:1, plain 18.78:1
body 1.00:1, secondary 2.68:1, plain 15.13:1
body 18.88:1, secondary 9.29:1, plain 15.13:1
body 1.00:1, secondary 2.32:1, plain 16.30:1
body 16.30:1, secondary 5.04:1, plain 16.30:1
body 1.00:1, secondary 1.66:1, plain 9.77:1
body 9.77:1, secondary 4.80:1, plain 9.77:1
body 1.00:1, secondary 1.20:1, plain 10.13:1
body 5.75:1, secondary 5.75:1, plain 10.13:1
Plain-string and number content renders as on
main: it skips the media wrapper, so the DOM and the pixels are the same. Each pair below is byte-identical (same PNG SHA-1), measured atmain(be5d290db9) and this head:main4242424242The Gothic and Matcha change also reaches their other light media surfaces. Secondary
Textin a Toast card and in an inverted panel underMediaTheme mode="auto", measured the same way (Matcha light mode puts those surfaces on the dark side, so it is unchanged):mainToast 2.32:1, panel 2.32:1
Toast 5.04:1, panel 5.04:1
Toast 4.80:1, panel 4.80:1
Toast 4.80:1, panel 4.80:1
Toast 3.46:1, panel 3.46:1
Toast 5.75:1, panel 5.75:1
Gothic is a dark-only theme, so it has one row.
Scope
Components: Tooltip (useTooltip, and through it every component that renders a tooltip), Toast (shared fallback, no behavior change), the Gothic and Matcha themes
First-load size
First-load JavaScript (gzip, bytes) per page that imports one component, measured with
scripts/measure-reference-pages.mjsagainstmainat2535488b:The remainder is the wrapper, the pre-measurement side and the measurement loader. The color measurement itself is in a separate chunk. (Before this change, reading
useTheme()cost about 12 KB on each entry.)First-show check
A cold first show is the worst case: the tooltip opens before the measurement chunk has arrived. The check serves a build with that chunk removed, then opens a
Texttooltip in real Chrome 157 (neutral theme):There is no flash: before the measurement, the side is the one opposite the color mode, and it reads the same as the measured side. A fixed
darkside was rejected earlier because it read 1.00:1 in dark mode.Stills at this head match the reviewed values: neutral light 18.78 and 7.01, neutral dark 18.88 and 9.29, Gothic dark 5.04 (secondary), Matcha light 4.80, and Matcha dark 5.75 (
Textbody and secondary). Plain strings are unchanged.Testing
vitest runoverpackages/core/src/Tooltip,Toast,theme,hooks,DialogHeroHeader,Pagination,InfoTipandscripts/check-cli-theme-bundle.test.mjs: 115 files, 3,644 tests pass.tsc, eslint on the changed files,pnpm check:knowledge, and the Gothic and Matcha palette-ref checks: pass.pr-a11y); the stills above measure the same colors in Chrome.Overlap checked: #12156, #11966, #11960, #11517, #12276, #11658, #11831, #11819, #11782, #11916, #11452, #11544, #11540, #11536, #11530, #11525, #11518, #11508, #11478, #11476, #11466, #11463, #8675, #8121, #11681, #11246, #10858, #10720 (each edits
Toast.tsx,useTooltip.tsxor the Gothic and Matcha themes for a different change; #12156, #11966, #11960, #11517, #12276, #11658, #11831, #11819 and #11782 merge cleanly with this change; #11916 and #11452 conflict in text inuseTooltip.tsx, so the second to merge resolves; the rest already conflict with main)Writing rubric results
R1 narration: none; the added sentence states what the content does.
R2 research: none in the record.
R3 evidence: the record names no test or change.
R4 rejected alternatives: none.
R5 change references: none.
R6 open questions: none.
R7 project status: none.