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🔎 Preview ·
|
… 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.
…test of the removed measurement; shorten the derivation header
There was a problem hiding this comment.
Changes requested. Measured locally in Chromium, Text content in a tooltip now reads in every theme and mode checked (secondary text at 4.56:1 to 4.61:1), and plain strings are unchanged.
- CI lint fails on the derivation file's header: the "(architecture:theme-tokens INV15)" citation at
tooltipTextDerivation.ts:6-7makes CI'slintjob fail on its comment-provenance baseline check (also reproduced locally; it passes on the base), so drop it, sincetheme-tokens.mdalready names the file under Owning code. - Five first-party themes get off-palette colors: the computed secondary and accent roles put values such as Gothic's
#646D77and#666D72into the builttheme.cssof Butter, Gothic, Matcha, Stone and Y2K, whose theme records require named palette stops, so set those roles to each theme's own stops that read at 4.5:1 (Gothic'sneutral.dark[50]reads 5.04:1) or have a design owner amend the records. - Token-colored content claims are broader than the fix: the title, the User impact paragraph and the changeset's first sentence say every token-colored component now reads, but status and hue icons keep the page's colors and measure 1.08:1 to 1.97:1 in Neutral dark, Matcha dark and Gothic, and the description's and changeset's "gets values computed" sentences do not hold for themes written in
hsl(),oklch()or outside variables, so bound each sentence to what holds. - The description misstates its evidence: it says the derivation test checks Gothic and Matcha, but the test now checks two fixtures, and it says the token docs follow the owner decision, but they are already in this pull request.
Approval also needs an engineering owner to approve the new architecture:theme-tokens INV15 and the reworded component:Tooltip "Tooltip text" row, which define the three tokens and their derivation, by commenting /approve-spec <full head SHA> on the fixed head (the author may do so as an engineering owner).
Claims and files checked
Review mode: full; reason: spec-record
- Title, token-colored content reads on the tooltip surface: false (status and hue icons, 1.08:1 to 1.97:1).
- User impact, content in
Textor another token-colored component can be read:Textverified (local Chromium probe, five theme and mode pairs); false for status and hue icons. - User impact, today the text sits near 1:1 on the tooltip: verified (local probe of the base, 1.00:1 to 1.12:1).
- User impact, secondary and accent text at 4.5:1 or more: verified (probe 4.56:1 to 4.61:1; every theme's computed roles 4.56:1 to 4.70:1).
- User impact and changeset, plain strings unchanged: verified (probe;
useTooltip.tsx:98). - User impact and changeset, nothing loads after paint and nothing is measured: verified (the diff adds no runtime code).
- The content style maps the text, icon and accent tokens to three roles: verified (
useTooltip.tsx:108-121). - A theme that does not set the roles gets computed values: false for
hsl(),oklch()and unresolved colors (tooltipTextDerivation.ts:95-103). - Core's defaults hold Core's computed values: verified (unit test, run locally).
- Owner decision section: reported.
- The Tooltip text row and INV15 record the roles: verified (
Tooltip.spec.md:256,theme-tokens.md:240-251). - The earlier after-paint modules are removed: verified (none at this head).
- The derivation test checks Gothic and Matcha: false (two fixtures,
tooltipTextDerivation.test.ts:57-79). - The contrast spec measures every shipped theme in light and dark: verified that it contains those cases; not run by CI at this head; the local probe agrees.
- Size, theme CSS figures and Chrome stills: reported (locally +65 to +75 B gzip per reference page against the base, with no new module kept).
- The theme editor, palette refs and token docs follow the owner decision: false for the token docs, which are in this pull request.
- Overlap with Text's cut-label tooltip: verified (its content inherits the tooltip color).
- Writing rubric results, scope and new public API named, no internal context: verified.
- Listed vitest runs,
check:changesetsandcheck:knowledge: verified (run locally). - Changeset, colors come from three new tokens, status and hue colors excluded: verified.
- Changeset, Text and token-colored components now read: false (status and hue icons).
- Changeset, a theme with concrete colors gets computed values: false for
hsl()andoklch(). - Changeset,
astryx docs tokenslists the roles: verified (token-docs check). - Changeset, core and cli packages: verified (the themes release with them).
- Files: changeset (finding),
Tooltip.stories.tsx(clear),theme-tokens.md(owner decision),Tooltip.spec.md(owner decision),tokens-color.doc.mjs(clear),tokens.doc.mjs(clear),TooltipContentContrast.a11y.chromium.spec.ts(clear),useTooltip.tsx(clear),statusRoleDefaults.ts(finding),tokens.stylex.ts(clear),tooltipTextDerivation.test.ts(clear),tooltipTextDerivation.ts(finding).
There was a problem hiding this comment.
Changes requested. Measured locally in Chromium, Text content in a tooltip now reads in every theme and mode checked (secondary text at 4.56:1 to 4.61:1), plain strings are unchanged, and the lint failure on the derivation header is fixed (CI's lint job passes).
- Native Swift tokens are stale: the generated Swift theme files lack the three new tokens, so the native drift test in
swiftIOSTheme.test.tsfails locally on this head (it passes on the base), and runningpnpm -F @astryxdesign/native generate:swift-iosand committing the output fixes it. - Five first-party themes get off-palette colors: the computed secondary and accent roles put values such as Gothic's
#646D77and#666D72into the builttheme.cssof Butter, Gothic, Matcha, Stone and Y2K, whose theme records require named palette stops, so set those roles to each theme's own stops that read at 4.5:1 (Gothic'sneutral.dark[50]reads 5.04:1) or have a design owner amend the records. - Token-colored content claims are broader than the fix: the title, the User impact paragraph and the changeset's first sentence say every token-colored component now reads and that accent keeps its own look, but status and hue icons stay at 1.08:1 to 1.97:1 in Neutral dark, Matcha dark and Gothic, accent turns the secondary grey in Neutral and Gothic, and the "gets values computed" sentences do not hold for themes written in
hsl(),oklch()or outside variables, so bound each sentence to what holds. - The description misstates its evidence: it says the token docs follow the owner decision, but they are already in this pull request (
tokens-color.doc.mjs). - The derivation copies the status-role derivation:
tooltipTextDerivation.tsrepeats the ratio constants,opaqueOverand the white-or-black ink fallback fromstatusRoleDerivation.ts, so move them intostatusColor.tsand call them from both.
Approval also needs an engineering owner to approve the new architecture:theme-tokens INV15 and the reworded component:Tooltip "Tooltip text" row, which define the three tokens and their derivation, by commenting /approve-spec <full head SHA> on the fixed head (the author may do so as an engineering owner).
Claims and files checked
Review mode: incremental; reason: none
- Title, token-colored content reads on the tooltip surface: false (status and hue icons, 1.08:1 to 1.97:1 locally).
- User impact, content in
Textor another token-colored component can be read:Textverified (local Chromium probe, seven theme and mode pairs); false for status and hue icons. - User impact, today that text sits near 1:1 on the tooltip: verified (local probe of the base, 1.00:1 to 1.12:1).
- User impact, secondary and accent keep their own look at 4.5:1 or more: the ratio is verified (4.56:1 to 4.61:1); "own look" is false in Neutral and Gothic.
- User impact and changeset, plain strings unchanged: verified (local probe).
- User impact and changeset, nothing loads after paint and nothing is measured: verified (the diff adds no runtime code).
- The content style maps the text, icon and accent tokens to three roles: verified (
useTooltip.tsx:110-122). - A theme that leaves the roles unset gets computed values: verified for hex themes (built
theme.css); false forhsl(),oklch()and unresolved colors (tooltipTextDerivation.ts:101-103). - Core's defaults hold Core's computed values: verified (unit test, run locally).
- Owner decision section: reported.
- The Tooltip text row and INV15 record the roles: verified (
Tooltip.spec.md:256,theme-tokens.md:240-251). - The earlier after-paint module, loader and wrappers are removed: verified (none at this head).
- New public API, three theme tokens: verified.
- The theme editor, palette refs and token docs follow the owner decision: false for the token docs, which are in this pull request.
- The derivation test covers Core, a dark and a light inverted surface, and a kept role: verified (read and run locally).
- Limits line, status and hue colors keep the page's values, roles stepped to about 4.58:1, grey accent in Neutral and Gothic: verified (local probe, built values).
- The contrast spec measures every shipped theme in light and dark: verified that it contains those cases; not run by CI at this head; the local probe agrees.
- Size, theme CSS figures, build and Chrome stills: reported.
- Overlap with Text's cut-label tooltip: reported.
- Writing rubric results and scope: verified.
- Listed vitest runs, committed token docs,
check:changesetsandcheck:knowledge: verified (run locally). - Changeset, colors come from three new tokens with status and hue excluded: verified.
- Changeset,
Textand other token-colored components now read: false (status and hue icons). - Changeset, a theme with concrete colors gets computed values: false for
hsl()andoklch(). - Changeset, plain text keeps the tooltip's color and nothing is measured: verified.
- Changeset,
astryx docs tokenslists the roles: verified (run locally). - Changeset, core and cli packages: verified (the themes release with them).
- Files: changeset (finding),
Tooltip.stories.tsx(clear),theme-tokens.md(owner decision),Tooltip.spec.md(owner decision),tokens-color.doc.mjs(clear),tokens.doc.mjs(clear),TooltipContentContrast.a11y.chromium.spec.ts(clear),useTooltip.tsx(clear),statusRoleDefaults.ts(finding),tokens.stylex.ts(finding),tooltipTextDerivation.test.ts(clear),tooltipTextDerivation.ts(finding).
…ext roles to named stops; an accent equal to the surface takes the secondary value
There was a problem hiding this comment.
Changes requested. Measured locally in Chromium, Text content in a tooltip now reads in every shipped theme and mode (body text 9.77:1 or more, secondary and accent 4.51:1 to 5.13:1), plain strings are unchanged, and Butter, Gothic, Matcha, Stone and Y2K now set the new roles to their own palette stops.
- Native Swift tokens are stale: the generated Swift theme files lack the three new tokens and the five themes' new values, so the native drift test in
swiftIOSTheme.test.tsfails locally on this head (it passes on the base); runpnpm -F @astryxdesign/native generate:swift-iosand commit the output. - Token-colored content claims are broader than the fix: the title, the User impact paragraph, the changeset's first sentence and INV15 say every token-colored component reads, that accent keeps its own look and that every unset theme gets computed values, but status and hue icons stay under 3:1, accent equals secondary in Gothic, Matcha, Neutral, Stone and Y2K, and a theme written in
hsl()oroklch()gets no computed roles, so bound each sentence to what holds. - Miss: The Tooltip text row cites an unrelated invariant:
Tooltip.spec.md:256citestheme-applicationINV8 for inherited tooltip text, but INV8 is aboutMediaThemekeeping the active theme, so drop the citation or point at the record's own theming map. - The description misstates its evidence: the palette refs and token docs it says come later are in this pull request, its 4.58:1 figure no longer holds for the five themes that set stops (4.51:1 to 5.13:1), and its "this head" stills for Gothic and Matcha come from an earlier build with computed colors.
- The derivation copies the status-role derivation:
tooltipTextDerivation.tsrepeats the ratio constants,opaqueOverand the white-or-black ink fallback fromstatusRoleDerivation.ts, so move them intostatusColor.ts, which both already import, and call them from both. - Existing surface tokens for inverted content: themes already describe content on inverted surfaces through
onDark/onLight, which Toast reads, and Gothic's theme record gives accent text on a light media surface its on-light color (#101314), while the tooltip on the same#e8f1f6surface now draws it in the secondary grey#5e676e; is the gap discoverability or capability? (non-blocking) - Stale comment on the token defaults:
tokens.stylex.ts:64says a theme's own values come from the derivation, which is no longer true for the five themes that set stops. (non-blocking)
Approval also needs an engineering owner to approve the new architecture:theme-tokens INV15 and the reworded component:Tooltip "Tooltip text" row, which define the three tokens and their derivation, by commenting /approve-spec <full head SHA> on the fixed head; the author may do so as an engineering owner.
Claims and files checked
Review mode: full; reason: spec-record
- Title, token-colored content reads on the tooltip surface: false (status and hue icons stay under 3:1, computed from the built theme CSS).
- User impact,
Textand other token-colored content can be read:Textverified (local Chromium probe, 13 theme and mode pairs); false for status and hue icons. - User impact, today that text sits near 1:1: verified (local probe of the base, 1.00:1 to 1.12:1).
- User impact, secondary and accent keep their own look at 4.5:1 or more: the ratio is verified (4.51:1 to 5.13:1); "own look" is false in Gothic, Matcha, Neutral, Stone and Y2K.
- User impact and changeset, plain strings unchanged: verified (local probe).
- User impact and changeset, nothing loads after paint and nothing is measured: verified (the diff adds no runtime code).
- Problem, token-colored content reads the page's colors: verified (base probe).
- The content style maps the text, icon and accent tokens to three roles: verified (
useTooltip.tsx:110-122). - An unset theme gets computed values: verified for hex themes; false for
hsl()andoklch()themes (local probe); the description leaves out the accent-equals-surface rule. - Core's defaults hold Core's computed values: verified (unit test, run locally).
- Owner decision section: reported.
- The Tooltip text row and INV15 record the roles: verified; INV15's computed-values sentence is false for
hsl()andoklch(), and the row's citation points at an unrelated invariant. - The earlier after-paint module, loader and wrappers are removed: verified (none at this head).
- Token defaults and the generation step: verified (
tokens.stylex.ts:65-67,statusRoleDefaults.ts:274). - New public API, three theme tokens: verified.
- Theme editor, palette refs and token docs follow the owner decision: false for the palette refs and token docs, which are in this pull request.
- The derivation test covers Core, a dark and a light inverted surface, and a kept role: verified (read and run locally).
- Limits, status and hue colors keep the page's values: verified; roles stepped to 4.58:1: false for the five themes that set stops; grey accent in Neutral and Gothic: incomplete (also Matcha, Stone and Y2K).
- The contrast spec measures text at 4.5:1 and icons at 3:1 in every shipped theme: verified that it contains those cases; not run by CI at this head; the local probe with the same measure passes in all 13 pairs.
- Size, theme CSS figures and build: reported.
- Chrome stills: reported; the Gothic and Matcha stills labelled this head show an earlier build's computed colors.
- Overlap with Text's cut-label tooltip: reported.
- Writing rubric results and scope checklist: verified.
- Listed vitest runs, committed token docs, changeset and knowledge checks: verified (run locally).
- Changeset,
Textand other token-colored components now read: false (status and hue icons). - Changeset, colors come from three new tokens with status and hue excluded: verified.
- Changeset, a theme with concrete colors gets computed values: false for
hsl()andoklch(). - Changeset, an accent equal to the surface takes the secondary color: verified (
tooltipTextDerivation.ts:75-82, unit test). - Changeset, the five themes and their CLI templates set named stops: verified (palette check and byte comparison, run locally).
- Changeset, plain text keeps the tooltip's color and nothing is measured: verified.
- Changeset,
astryx docs tokenslists the roles: verified (run locally). - Changeset packages: verified (the themes release together).
- Files: changeset (finding),
Tooltip.stories.tsx(clear),theme-tokens.md(owner decision, finding),Tooltip.spec.md(owner decision, finding),tokens-color.doc.mjsandtokens.doc.mjs(clear, generated), the nine CLI theme bundle files (clear, generated copies),TooltipContentContrast.a11y.chromium.spec.ts(clear),useTooltip.tsx(clear),statusRoleDefaults.ts(clear),tokens.stylex.ts(finding),tooltipTextDerivation.test.ts(clear),tooltipTextDerivation.ts(finding), the five theme sources and four palette refs underpackages/themes/(clear).
…native tokens; bound the changeset
There was a problem hiding this comment.
Changes requested. Measured locally in Chromium, Text and primary, secondary and accent icons in a tooltip now read in all seven shipped themes, light and dark (body text 9.77:1 or more, secondary 4.51:1 to 5.13:1), plain strings are unchanged, and the native Swift tokens and shared contrast helpers from the last round are fixed.
- INV15, the Tooltip text row and the changeset claim more than the code does: INV15 and the Tooltip text row say all token-colored content takes the new roles, and INV15 and the changeset promise computed values to every theme with concrete colours, but status, hue and disabled colors keep the page's values and a theme written in
hsl()oroklch()gets no derived roles, so bound those sentences as the description already does. - The description misstates its evidence: its 4.58:1 figure (the shipped values run from 4.51:1 to 5.13:1), its "this head" stills for Gothic and Matcha (taken before those themes moved to named stops), its claim that the derivation is in no first load (it rides with
Theme,ToastanduseTheme) and a test file it names that does not exist all need correcting. - The Tooltip text row cites an unrelated invariant:
Tooltip.spec.md:256citestheme-applicationINV8, which is aboutMediaThemekeeping the active theme, so drop it or point at the row's own theming map. - Stale comment on the token defaults:
tokens.stylex.ts:64says a theme's own values come from the derivation, which is no longer true for the five themes that set stops (non-blocking). - Existing surface tokens for inverted content: themes already describe content on inverted surfaces through
onDark/onLight, and Gothic's record gives accent text on a light media surface#101314while the tooltip on the same surface now draws it in the grey#5e676e, so is the gap discoverability or capability (non-blocking)?
Approval also needs an engineering owner to approve the new architecture:theme-tokens INV15, the three new tokens and the reworded component:Tooltip "Tooltip text" row by commenting /approve-spec <full head SHA> on the fixed head; the author may do so as an engineering owner.
Claims and files checked
Review mode: incremental; reason: none
- Changed rules (0): none since the last review's rules.
- Title, Text content reads on the tooltip surface through theme text roles: verified (Chromium probe of 14 theme and mode pairs; useTooltip.tsx:110-122).
- User impact, Text and primary, secondary or accent icons become readable: verified (same probe).
- User impact, today that text sits at about 1:1: verified on the base (1.00:1 to 1.12:1).
- User impact, secondary text at 4.5:1 or more in every shipped theme: verified (built theme.css, 4.51:1 to 5.09:1).
- User impact, accent keeps its own color in Core's defaults and Butter: verified (built values keep the hue).
- User impact, accent reads as secondary where the accent is the surface color (Gothic, Matcha, Stone, Y2K): verified (theme sources).
- User impact, status and hue colors keep the page's values: verified (useTooltip.tsx:110-122).
- User impact, plain strings unchanged: verified (probe, all 14 pairs).
- User impact, nothing loads after paint and nothing is measured: verified (no loader or measurement in the diff).
- Problem, the tooltip paints the inverted surface while content reads page tokens: verified (base code and probe).
- Solution, the content style maps text, icon and accent tokens to three roles: verified.
- Solution, hex or rgb() themes that leave the roles unset get computed values, as described, and Core's defaults are computed: verified (tooltipTextDerivation.ts; its test passes here).
- Solution, five themes set each role to the nearest stop that clears 4.5:1, in package and template, refs regenerated: verified (palette checks pass here; nearest stop computed per ramp).
- Owner decision, option A with an owner card pending: reported.
- Authority, the Tooltip row names the roles and INV15 records them: verified (records at this revision).
- Restoration list (hook mapping, earlier side module removed, token defaults, derivation, themes, token docs, shared helpers, Swift tokens, three new tokens): verified (diff; token-docs check and Swift drift test pass here).
- Evidence, the derivation test covers defaults, two fixtures and a kept role: verified (test file, passes here).
- Evidence, secondary and accent stepped to 4.58:1: false (4.51:1 to 5.13:1; five themes use named stops).
- Evidence, Neutral and Gothic accent is grey: verified.
- Evidence, the Chromium spec covers text and icons in every theme: reported (not run here; heavy CI deferred).
- Evidence, reference-page and theme CSS size deltas, and the build passes: reported.
- Evidence, the derivation is in no first load: false (Theme.tsx:63 through generateThemeRules and statusRoleDefaults.ts:17; Toast and useTheme through tokens.ts:26).
- Stills, the head column shows this revision's colors: false for Gothic and Matcha (their theme values changed after those stills).
- Overlap with the cut-label tooltip pull request: reported.
- Records changed list: verified.
- Scope checklist, one defect, tagalongs removed, public API named, no internal context: verified (no residue found).
- Testing, the listed vitest files all pass: false (one named file does not exist; the others pass here).
- Testing, check:changesets and check:knowledge clean: verified (run here).
- Changeset, Text and primary, secondary and accent icons now read: verified.
- Changeset, colors come from three new tokens and status and hue keep page values: verified.
- Changeset, a theme with concrete colors gets computed values: false (hsl() and oklch() themes get none, tooltipTextDerivation.ts:93-94).
- Changeset, an accent equal to the surface takes the secondary color: verified.
- Changeset, five themes and their templates set named stops: verified.
- Changeset, plain text keeps the tooltip color, nothing is measured, and the token reference lists the roles: verified.
- Changeset, packages named (core, cli, five themes): verified (Chocolate and Neutral release in the same fixed version group).
- Files, .changeset/tooltip-content-media-theme.md: finding (concrete colors).
- Files, apps/storybook/stories/Tooltip.stories.tsx: clear.
- Files, docs/architecture/theme-tokens.md: finding (INV15 scope); owner approval pending.
- Files, docs/specs/components/Tooltip/Tooltip.spec.md: findings (scope, INV8 citation); owner approval pending.
- Files, packages/cli/assets/docs/tree/tokens-color.doc.mjs and tokens.doc.mjs: clear (generated, check passes).
- Files, the nine CLI theme template files for Butter, Gothic, Matcha, Stone and Y2K: clear (match the packages).
- Files, packages/core/src/Tooltip/tests/TooltipContentContrast.a11y.chromium.spec.ts: clear.
- Files, packages/core/src/Tooltip/useTooltip.tsx: clear.
- Files, packages/core/src/theme/statusColor.ts, statusRoleDefaults.ts and statusRoleDerivation.ts: clear.
- Files, packages/core/src/theme/tokens.stylex.ts: non-blocking (stale comment).
- Files, packages/core/src/theme/tooltipTextDerivation.ts and its test: clear in code; cited by the claim finding.
- Files, the nine generated Swift files under packages/native: clear (drift test passes).
- Files, the nine theme package files for Butter, Gothic, Matcha, Stone and Y2K: clear; Gothic's accent role noted against its record (non-blocking).
…d accent, and the derivation to hex or rgb() themes
There was a problem hiding this comment.
Not ready to approve yet: an engineering owner's decision on the new tokens is pending, and two text fixes are needed either way. The fix itself works: Text in a tooltip now reads in every shipped theme, light and dark (body 9.77:1 or more, secondary 4.51:1 or more, measured in Chromium).
- INV15 still claims more than the code does: it says text on
--color-background-invertedtakes the three roles, but Toast paints that surface and colors its content throughMediaTheme, and it promises derived values to any theme with one hex orrgb()source colour, though the derivation returns nothing when another of the four isoklch(),hsl()orcolor-mix(), so scope it to tooltip content and to themes whose four source colours all parse. - The description misstates its evidence: the "stepped to 4.58:1" figure (shipped values run from 4.51:1 to 5.13:1, and five themes use named stops), the Gothic and Matcha stills labelled as this head (taken before those themes moved to named stops), "the derivation is not in any first load" (every page that renders
Themeloads it) and the missingstatusRoleDefaults.test.tsneed correcting.
Approval also needs an engineering owner to approve INV15, the three new public tokens and the reworded Tooltip "Tooltip text" row at this revision, by commenting /approve-spec <full head SHA> on the pull request; the author may do so as an engineering owner.
- Tooltip content comment is broader than the code (non-blocking): the comment at
useTooltip.tsx:108says "Token-colored content", but status, hue and disabled tokens keep the page's values; "Content colored by the primary, secondary or accent tokens, such asText, …" is accurate.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Title, tooltip
Textreads on the tooltip surface through theme roles: verified (Chromium probe, seven themes and Core's defaults, light and dark). - Today such text is about 1:1: verified (1.00:1 to 1.30:1 on the base).
- Secondary text keeps 4.5:1 or more in every shipped theme: verified (4.51:1 to 5.09:1).
- Accent keeps its own color in Core and Butter, and reads as secondary text where the accent is the surface (Gothic, Matcha, Stone, Y2K): verified from the built CSS.
- Status and hue colors keep the page's values; plain strings unchanged: verified (code; plain text equals the tooltip's color in all 16 pairs).
- Nothing loads after paint and nothing is measured: verified (no runtime measurement or deferred module remains).
- Derivation for themes in hex or
rgb(): primary is the surface colour or white or black, secondary and accent at the nearest lightness reaching 4.5:1, an accent equal to the surface takes the secondary value: verified (unit test and a direct call); Core's defaults equal the computed values: verified (unit test). - Five themes set the roles to the nearest stop that clears 4.5:1, in the package and the CLI template: verified (each stop checked against its palette; palette-ref checks; template regeneration identical).
- Shared helpers, token docs and Swift tokens: verified (token-doc check, Swift drift test).
- Secondary and accent are stepped to 4.58:1: false.
- The stills show this head: false for Gothic and Matcha.
- The derivation is not in any first load: false outside the four reference pages.
- Size: +269 B and +64 to +75 B gzip on the four reference pages: reported, reproduced (+65 to +75 B); theme CSS sizes: reported.
- Tests listed under Testing all pass: false (one listed file does not exist); changeset and knowledge checks clean: verified.
- Changeset: every sentence verified; its theme bound ("written in hex or
rgb()") holds. - INV15: false in two places (Toast's surface; themes that mix colour syntaxes); the Tooltip text row: verified.
Files:
docs/architecture/theme-tokens.md: INV15 finding.docs/specs/components/Tooltip/Tooltip.spec.md,.changeset/tooltip-content-media-theme.md: clear, pending owner approval.packages/core/src/Tooltip/useTooltip.tsx: comment note.packages/core/src/theme/tooltipTextDerivation.ts: the INV15 fallback finding;tooltipTextDerivation.test.ts,statusColor.ts,statusRoleDefaults.ts,statusRoleDerivation.ts,tokens.stylex.ts: clear.packages/core/src/Tooltip/__tests__/TooltipContentContrast.a11y.chromium.spec.ts,apps/storybook/stories/Tooltip.stories.tsx: clear.- Butter, Gothic, Matcha, Stone and Y2K theme sources and palette refs, in the packages and the CLI templates: clear.
- Generated Swift theme and token files,
tokens-color.doc.mjs,tokens.doc.mjs: clear.
…se four source colours parse
There was a problem hiding this comment.
Changes requested: three text and contrast defects need fixing, and an engineering owner's decision on the new tokens is still pending; the fix itself works for Text and colored icons (measured in Chromium, body text reads 9.77:1 or more and secondary text 4.51:1 or more in every shipped theme, light and dark).
- Inline
Codein tooltip text becomes unreadable: the content style remaps--color-text-primary, butCodekeeps the page's--color-background-muted, so<Text>Run <Code>pnpm build</Code></Text>drops from 8.49:1–18.59:1 to 1.08:1–1.52:1 in Neutral, Matcha, Chocolate and Stone, light and dark (measured in Chromium), so remap the surfaceCodepaints as well and add aCodecase to the story and the contrast spec. - INV15, the changeset and the description promise derived roles a mid-tone inverted surface does not get:
solveLightnessheads for white whenever the fill's luminance is 0.18 or less, and white misses the 4.58:1 solve target on fills between about 0.1793 and 0.18, so a hex theme with a#0078D0inverted surface gets no roles and keeps Core's (secondary and accent text at 1.12:1), so solve toward black when that fails and add a mid-tone fixture, or bound all three statements. - The description names the wrong item for its overlap check: #12235 is an issue about
MediaThemeauto measurement, not Text's cut-label tooltip, so name the pull request that was checked or drop the line.
Approval also needs an engineering owner to approve INV15, the three new public tokens and the reworded Tooltip "Tooltip text" row at this revision by commenting /approve-spec <full head SHA> on the pull request; the author may do so as an engineering owner.
- The second derivation fixture is not a light inverted surface (non-blocking): the fixture named "light inverted surface" paints
#2F3826in light mode, the same shape as the first, so rename it or add a light-in-both-modes fixture like Gothic. - Neutral's derived roles sit between palette stops (non-blocking): Neutral's
theme.cssgets#7D7D7Dand#757575, while its stops 55 and 45 clear 4.5:1 on its tooltip, so owners approving INV15 may want Neutral to set named stops like the other five.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Title, tooltip
Textreads on the tooltip surface through theme roles: verified (Chromium probe, Core's defaults and seven themes, light and dark). - Today such text sits near 1:1: verified on the base (1.00:1 to 1.30:1).
- Secondary text keeps 4.5:1 or more in every shipped theme: verified (4.51:1 to 5.09:1).
- Accent keeps its own color in Core and Butter and reads as secondary text where the accent is the surface (Gothic, Matcha, Stone, Y2K): verified (probe).
- Status and hue colors keep the page's values; plain strings unchanged: verified (code; probe, 16 pairs).
- Nothing loads after paint and nothing is measured: verified (code).
- The content style maps the text, icon and accent tokens to three roles: verified (code).
- A theme in hex or
rgb()that leaves the roles unset gets computed values (description, changeset, INV15): false for a mid-tone inverted surface such as#0078D0. - Primary is the surface colour, else white or black; an accent equal to the surface takes the secondary value; Core's defaults equal the computed values: verified (code, unit test).
- Five themes set the roles to the nearest stop that clears 4.5:1, in the package and the CLI template, with refs regenerated: verified (neighbour stops computed; palette-ref checks and template regeneration run here).
- Earlier side module, loader and wrappers are gone: verified (none at this head).
- Token docs, shared helpers in
statusColor.ts, Swift tokens: verified (token-doc check, imports, Swift drift test). - New public API is three theme tokens: verified (API delta, 28 rows across Core and seven themes).
- The unit test covers Core's defaults, a dark and a light inverted surface, and a kept role: verified (the second fixture's name is a non-blocking note).
- Shipped secondary and accent values run 4.51:1 to 5.13:1: verified.
- In Neutral and Gothic the accent role is grey: verified.
- The contrast spec measures every shipped theme, light and dark: verified as written; not run here.
- Size figures and theme CSS sizes: reported.
- The derivation loads with
Theme,ToastanduseTheme: verified (import chain). pnpm buildpasses: reported (Core and theme builds pass here).- The overlap check names #12235 as Text's cut-label tooltip: false (#12235 is a
MediaThemeissue). - The stills come from a build whose later commits change records and comments only: verified (diff of those commits).
- Records changed and rubric results: verified.
- The Tooltip and theme tests pass; token docs committed; changeset and knowledge checks clean: verified (2,270 tests and the checks run here).
- Changeset: every sentence verified except the derivation sentence (false, as above); the listed packages are in the release's fixed group.
Files:
packages/core/src/Tooltip/useTooltip.tsx: inlineCodefinding.packages/core/src/theme/tooltipTextDerivation.ts,statusColor.ts: mid-tone derivation finding;statusRoleDefaults.ts,statusRoleDerivation.ts,tokens.stylex.ts: clear.packages/core/src/theme/tooltipTextDerivation.test.ts: fixture-name note.docs/architecture/theme-tokens.md,.changeset/tooltip-content-media-theme.md: mid-tone derivation finding; pending owner approval.docs/specs/components/Tooltip/Tooltip.spec.md: clear, pending owner approval.packages/core/src/Tooltip/__tests__/TooltipContentContrast.a11y.chromium.spec.ts,apps/storybook/stories/Tooltip.stories.tsx: clear.- Butter, Gothic, Matcha, Stone and Y2K theme sources and palette refs, in the packages and the CLI templates: clear.
- Generated Swift theme and token files,
tokens-color.doc.mjs,tokens.doc.mjs: clear.
| [colorVars['--color-text-primary']]: | ||
| colorVars['--color-text-primary-inverted'], |
There was a problem hiding this comment.
This remaps the text color but not the surface a child paints for itself. Code keeps the page's --color-background-muted (Code.tsx:35) under this inverted text, so <Text>Run <Code>pnpm build</Code></Text> in a tooltip drops from 18.59:1 to 1.13:1 in Neutral light, and to 1.08:1–1.52:1 in Matcha, Chocolate and Stone (measured in Chromium). Remap the muted surface here too, for example to a translucent tint of the inverted text role (the way every theme's --color-neutral already composites onto the tooltip), and add a Code case to RichContent and the contrast spec.
| if (muted === null || accentText === null) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
solveLightness heads for white whenever the fill's luminance is 0.18 or less. On a fill between about 0.1793 and 0.18, white reads at most 4.57:1, under SOLVE_RATIO, so this returns null and the whole theme gets no roles. A direct call with a light inverted surface of #0078D0 returns []; #0070C0 returns all three. Black reads 4.59:1 or more on such a fill, so one fix is to retry toward black here:
const solve = (color: RGBA) =>
solveLightness(color, [fill], SOLVE_RATIO) ?? readableInk(color, fill);The changeset, INV15 and the description promise values for every hex or rgb() theme, so either fix this or bound all three.
| 'light inverted surface': { | ||
| '--color-background-surface': 'light-dark(#ffffff, #1a1c14)', | ||
| '--color-background-inverted': 'light-dark(#2f3826, #e8eddc)', |
There was a problem hiding this comment.
Non-blocking: this fixture's light mode paints #2F3826, a dark inverted surface, so it has the same shape as the first fixture. Rename it, or make one fixture light in both modes, as Gothic is.
…surface still gets derived roles
# Conflicts: # packages/cli/assets/docs/tree/tokens.doc.mjs # packages/cli/assets/templates/themes/butter/butterPaletteRefs.generated.ts # packages/cli/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts # packages/cli/assets/templates/themes/stone/stonePaletteRefs.generated.ts # packages/themes/butter/src/butterPaletteRefs.generated.ts # packages/themes/matcha/src/matchaPaletteRefs.generated.ts # packages/themes/stone/src/stonePaletteRefs.generated.ts
User impact
People reading a tooltip whose content uses
Textor icons colored by the primary, secondary or accent tokens, as the Tooltip docs show, can read it: today that text takes the page's own text colors on the tooltip's inverted surface, so dark text sits on a dark tooltip (about 1:1). Secondary text keeps its own, quieter look at 4.5:1 or more in every shipped theme; accent text keeps its own color in Core's default theme and Butter, and reads as secondary text in themes whose accent is the tooltip surface's own color (Gothic, Matcha, Stone, Y2K). Status and hue colors (<Icon color="success">) keep the page's values. Plain-string tooltips are unchanged. Nothing loads after the page paints and nothing is measured on the page.Problem and solution fit
--color-background-invertedwith--color-background-surfaceas its text, but token-colored content reads--color-text-primary,-secondaryand-accent, which are the page's colors.--color-text-primary-inverted,--color-text-secondary-invertedand--color-text-accent-inverted.rgb()) that does not set them gets values computed when the theme is generated, beside the status roles: primary is the theme's surface colour, else white or black at 4.5:1; secondary and accent are the theme's secondary text and accent at the nearest lightness that meets 4.5:1 on the inverted surface, light and dark; an accent equal to the inverted surface takes the secondary value. Core's defaults hold the values computed from Core's own colors.Owner decision
This head carries option A ("keep secondary and accent distinct", 3 new theme tokens). Cindy's card asks A or B (one color for all tooltip text, no new tokens). If B is chosen, the head changes to B and CI runs again.
Expected behavior and authority
component:Tooltip: the "Tooltip text" row names the three roles.architecture:theme-tokensINV15 (new) records the roles and their derivation. WCAG 2.2 SC 1.4.3.Smallest restoration
Tooltip/useTooltip.tsx: the content style maps the text, icon and accent tokens to the inverted roles. The earlier after-paint side module, its loader and its wrapper components are removed.theme/tokens.stylex.ts: the three roles, with Core's computed defaults.theme/tooltipTextDerivation.ts(new) andtheme/statusRoleDefaults.ts: the generation step for a theme that leaves the roles unset.packages/themes/{butter,gothic,matcha,stone,y2k}/src/*Theme.ts, their CLI template copies and selected palette refs: the three roles on named stops.astryx docs tokens) list the three roles.theme/statusColor.ts: the text floor, the solve ratio,opaqueOverandreadableInk(the theme's ink, else white or black) are shared by the status-role and tooltip-role derivations.packages/native/apple/.../Generated/*.swift) carry the three roles.--color-text-primary-inverted,--color-text-secondary-inverted,--color-text-accent-inverted).Evidence
tooltipTextDerivation.test.ts: Core's defaults equal the computed values; a theme with a dark and one with a light inverted surface get all three roles at 4.5:1 or more in light and dark; a role a theme sets is kept.<Icon color="success">) in tooltip content keep the page's values. Shipped secondary and accent values run from 4.51:1 to 5.13:1 on the tooltip surface, just over the floor. In the Neutral and Gothic themes the stepped accent is gray, so a link reads like secondary text there.TooltipContentContrast.a11y.chromium.spec.ts: tooltip text 4.5:1 and icons 3:1 on the painted surface in every shipped theme, light and dark.pnpm size:pagesagainst the merge base c426530, minified / gzip): +269 / +64 to +75 B on the four reference pages, with no module kept on any page. The derivation runs where a theme's CSS is generated at runtime, so it loads withTheme(andToastanduseTheme). Theme CSS (gzip): Coreastryx.css+130 B, Gothic and Matchatheme.css+46 B each.pnpm buildpasses.Overlap checked: #12235 (Text's cut-label tooltip, which renders through Tooltip; no change to the content colors here)
Real Chrome stills
Branded Google Chrome 158.0.8127.108 on macOS.
mainfrom the earlier run; this pull request's build at 8718581 (the same tooltip and theme code as this head; later commits change records and comments only) fromchrome-macos-stillsrun 47107587518. TheRichContentstory, every tooltip open.mainWriting rubric results
Records changed:
architecture:theme-tokens(INV15, its trigger, Owning code and Verification rows) andcomponent:Tooltip(the "Tooltip text" row).Scope
Components: Tooltip; theme tokens (new:
--color-text-primary-inverted,--color-text-secondary-inverted,--color-text-accent-inverted)Testing
vitest run packages/core/src/Tooltip packages/core/src/theme packages/native/src/theme/swiftIOSTheme.test.ts: all pass (2,013 theme tests; 98 native).node scripts/generate-token-docs.mjsoutput committed.check:changesetsandcheck:knowledge: clean.