Repository navigation
fix(theme): selected table rows and commands take the theme's palette-stop text on the accent tint - #12639
fix(theme): selected table rows and commands take the theme's palette-stop text on the accent tint#12639josephfarina wants to merge 33 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec d7c2df0 |
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: the selected-row fix works for Neutral, for Y2K in light mode and for Butter outside coloured cards, but every second selected row inside a coloured card in Butter still reads under 4.5:1, and the CLI theme bundle was not regenerated.
- In Butter, the new
[STRIPED_ROW]entry in thetable-rowselectedrule (butterTheme.ts:534) matches every even row, striped table or not, and outranks the coloured-card entries below it, so the second selected row inside a blue card reads 4.08:1 (3.83:1 in a yellow card) in light mode; repeat the coloured-card entries compounded with the striped selector (iny2kTheme.ts:487too) and add an even-row case to the role contrast guard, whose card model only builds a single row. - The changeset says light and dark Butter now read at 4.5:1 or better and the description says every official theme's selected row does inside cards, which at this head holds only for odd rows, and the changeset's dark Butter "3.98:1" before-value does not match the guard's 3.50:1 on the page and 2.88:1 in a default or muted card; restate both after the fix.
packages/cli/assets/templates/themes/still holds the old Butter, Y2K and Neutral sources, soscripts/check-cli-theme-bundle.test.mjsfails for those three themes andastryx theme ejectscaffolds the old contrast; runpnpm bundle:cli-themesand commit the result.
On the base, the new guard ground fails on 147 grounds; on this head, the three themes' tests and the guard pass. Smaller notes: the new comments call the even-row rule a striped row's rule, and in dark Butter and dark Y2K an even row's primary text inside a coloured card keeps the theme's light ink, which this change did not introduce.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: dark Neutral read 3.47:1 before: verified (role guard on the base, Chromium render).
- Claim: dark Butter read 3.98:1 before: not reproduced (role guard 3.50:1 on the page, 2.88:1 in a default or muted card).
- Claim: light Butter read 3.84:1 in a blue card and 4.29:1 in a muted card before: verified (3.85:1 and 4.31:1).
- Claim: light Y2K read 4.42 to 4.47:1 before: verified (role guard, pink and red cards).
- Claim: after the change every official theme's selected row reads at 4.5:1 or better in light and dark, on the page and in cards: false for even rows inside coloured cards (light Butter 4.08:1 and 3.83:1, dark Butter 1.08:1, dark Y2K 1.56:1).
- Claim: a selected table row paints the same tint as a selected list or tree row, and the themes lifted only those rows: verified (the selection wash reads the accent tint; the theme rules).
- Claim: striped rows set their own text colours with a more specific selector, so the selected rule repeats it: partly true; the repeat is needed, but the selector matches every even row and overrides the coloured-card values.
- Claim: the role guard fails on main for Neutral dark, Butter light and dark and Y2K light, and passes with the change: verified (147 failing grounds on the base; pass on the head).
- Claim: the Neutral test holds the table-row value to 4.5:1 on the fill and its hover and checks the generated selector: verified.
- Claim: the stated test command passes (71 tests): verified.
- Claim: no new public API, default or interaction model: verified (built surfaces of the three themes unchanged).
- Changeset: patch release for the three themes: verified.
- Changeset: secondary text reads at 4.5:1 or better in dark Neutral, light and dark Butter (including in a blue card) and light Y2K: false for even rows inside coloured cards in Butter.
- Changeset: the table row takes the same lift as a list or tree row, including in a striped table: false inside coloured cards for even rows, which take the page lift.
- File
.changeset/themes-selected-table-row-secondary.md: finding (claims). - File
packages/themes/butter/src/butterTheme.ts: finding (even-row entry outranks coloured-card entries; comment wording). - File
packages/themes/y2k/src/y2kTheme.ts: finding (same entry; changes dark mode; comment wording). - File
packages/themes/neutral/src/neutralTheme.ts: clear. - File
packages/themes/neutral/src/neutralTheme.test.ts: clear. - File
scripts/check-text-contrast-by-role.test.mjs: finding (the card model never builds an even row). - Cross-file: the CLI theme bundle copies of the three themes are not updated: finding.
d7c2df0 to
e1a3a06
Compare
|
/approve-spec 266340c |
There was a problem hiding this comment.
Changes requested: INV22 is now approved, and the CLI theme bundle, the module record and the second selected row in coloured cards are fixed, but four fixes remain.
- Lint's Changeset coverage check fails because the regenerated CLI theme bundle ships without a changeset naming
@astryxdesign/cli, so add'@astryxdesign/cli': patchto.changeset/core-selected-tint-text.md. - The changeset's "4.5:1 in every theme" and the description's "every card, at rest and hovered" go beyond INV22 as approved, since Chocolate's hovered selected row reads 3.97:1 in an orange card and 4.03:1 in a pink card, the contrast guard adds hover on the page only although INV22's verification row says every card, and dark Butter's before figure is 3.50:1, not 3.98:1.
theme:neutralstill says Neutral lifts selected secondary text toneutral.dark[80]on items, tree rows, numbered citations and dropzones, which this change deletes, so that paragraph needs amending in this pull request.over()inselectedTintText.tscopiesopaqueOver()fromstatusRoleDerivation.ts, so export that helper and call it from both.
The description should also report the first-load gzip deltas on the four reference pages, since seven components now import a new shared module. CI's heavy jobs did not run on this head because CI was full, so it still needs a full run.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0)
Claims:
- INV22, its verification row and the new applies_to and verified_by paths are added to the theme-compilation record: verified (record diff); the row's account of the guard is false (finding).
- Before the change, a selected table row read 3.47:1 in dark Neutral: verified (computed 3.47).
- Before the change, dark Butter read 3.98:1: false (3.50:1 on the page).
- Before the change, light Butter in a blue card read 3.84:1 and light Y2K 4.42 to 4.47:1: verified in the earlier review; the base is unchanged.
- After the change, every official theme reads 4.5:1 or better at rest and hovered on the page, the surface and every card: false (Chocolate's orange and pink cards when hovered).
- Core moves the theme's own secondary text by the least amount that reads on the tint and its hover, as a private variable, and measures again inside a rule that sets secondary text: verified (derivation, built theme CSS, unit tests).
- Every part that paints the tint reads the value: verified for the seven listed parts.
- A theme rule keyed on the tinted state sets the text there: verified (unit test; theme rules sit in a later cascade layer than Core's).
- After a theme rule that sets secondary text on a tinted part at rest, generation writes the same rule in the tinted state with the measured text: verified (built Butter and Y2K CSS).
- The CLI's bundled Neutral, Butter and Y2K are regenerated: verified (rerunning the bundler changes nothing).
- The per-part rules, the coloured-card selectors and the palette stops only they used are deleted: verified.
- The contrast guard checks every selected part at rest and hovered on the page, the surface and every card: false (hover on the page only).
- The unit tests hold Core's value to the derivation and the derivation to 4.5:1, and the Neutral test reads the derived value: verified (they pass).
- Core's light value moves from #4E606F to #4A5C6B and dark is unchanged: verified (unit test).
- No new public API, and the variable is private: verified (built-surface comparison).
- Public text carries no internal context: verified.
- The knowledge check passes: verified.
- The listed test suites pass: verified for the touched suites.
- The look gate shows no new findings: unverified (no result for this head).
- Changeset: core and the three themes take a patch: verified; it omits the CLI (finding) and repeats the overbroad claim and the Butter figure (finding).
Files:
.changeset/core-selected-tint-text.md: findings (missing CLI package, overbroad claim, Butter figure).docs/architecture/theme-compilation.md: INV22 approved; its verification row overstates the guard (finding); no INV21 (note).packages/cli/assets/templates/themes/butter/butterPaletteRefs.generated.ts: clear (generated, in sync).packages/cli/assets/templates/themes/butter/butterTheme.ts: clear (regenerated, identical).packages/cli/assets/templates/themes/neutral/neutralTheme.ts: clear (regenerated, identical).packages/cli/assets/templates/themes/y2k/y2kTheme.ts: clear (regenerated, identical).packages/core/src/CheckboxList/CheckboxListItem.tsx: clear.packages/core/src/Citation/Citation.test.tsx: clear.packages/core/src/Citation/Citation.tsx: clear.packages/core/src/CommandPalette/CommandPaletteItem.tsx: clear.packages/core/src/FileInput/FileInput.tsx: clear.packages/core/src/Item/Item.tsx: clear.packages/core/src/Table/plugins/selection/useTableSelection.tsx: clear.packages/core/src/TreeList/TreeListItem.tsx: clear.packages/core/src/theme/derivedVarRegistry.test.ts: clear.packages/core/src/theme/generateThemeRules.ts: clear, with one placement note.packages/core/src/theme/selectedTintText.stylex.ts: clear (named by the approved INV22).packages/core/src/theme/selectedTintText.test.ts: clear.packages/core/src/theme/selectedTintText.ts: finding (copied helper).packages/core/src/theme/statusRoleDerivation.ts: clear.packages/themes/butter/src/butterPaletteRefs.generated.ts: clear (in sync with its generator).packages/themes/butter/src/butterTheme.ts: note (leftover comment lines).packages/themes/neutral/src/neutralTheme.test.ts: clear.packages/themes/neutral/src/neutralTheme.ts: finding (contradicts its theme record).packages/themes/y2k/src/y2kTheme.ts: note (leftover comment lines).scripts/check-text-contrast-by-role.test.mjs: finding (no hover layer on the surface and in cards).
|
Owner decision update (engineering owner, covering this pull request at its current head): |
|
/approve-spec cf68fcf |
…the neutral track and the coloured cards; Core measures it on the accent tint
…dary text; palette docs say Core measures text on the accent tint
…w-selected-secondary
…ed text on a selected List row
…w-selected-secondary [skip ci]
…ge (readers and gates, look families, undo, page text, status and contrast notes)
…source-walk module; theme use and add's import check reuses it
…nge (border colours that show, padding sides, corner asks, hide and remove, token colours, regrown looks)
…nge (bar reach, checks and radios, picture traits, family sizes, saved --only)
… as that state Another word for exactly one of a part's states is written as that state, with a note (pressed where the press is active); a word for several is still offered. A census state (a list item's selected, marked by its Item) is written as the attribute Core marks inside the plain rule, so the build takes it with no unknown-prop warning and a saved one builds the same with no rewrite. [skip ci]
…e opens unchanged A palette recipe this CLI does not make keeps the saved palette and the settings module the newer CLI wrote exactly as they are; show builds the same CSS theme build makes of them, and a note names the recipe. Changes that leave the colors alone save and keep each token as the saved module writes it; a change to what the palette is made from (a color dial, the vibrancy, the whole-theme accent token, or a seed or color added by hand) is refused, naming the recipe and what still works, with no update step. That CLI's build of the same settings counts as current. Recorded in AST-050 beside DEC-11. [skip ci]
# Conflicts: # docs/specs/AST-050-app-themes/spec.md
# Conflicts: # packages/cli/api/theme-edit/_palette.mjs # packages/cli/api/theme-edit/theme-accent-lift.test.mjs # packages/cli/api/theme-edit/theme-changed-tokens-built-values.test.mjs
…the theme guide keeps its formatting
rubyycheung
left a comment
There was a problem hiding this comment.
Thanks for improving the contrast! All colors need to come from existing palette steps. Please use the next existing step that passes contrast, including hover and card backgrounds, instead of calculating a new shade.
…w-selected-secondary Main squashed batch 107, which this branch had merged as separate commits; the merge keeps this pull request's own changes on top of main. [skip ci]
…-stop text on the accent tint Neutral, Butter and Y2K set the two missing parts with their own palette stops, and Butter's and Y2K's stops also read under a hover. The palette mapping lifts the same parts. The contrast guard checks every part on the tint, nested cards and a hover. Core's measured shade and its modules are removed. [skip ci]
|
Covers, as the engineering owner (the owner's ruling): the INV22 known-gap entry and the Neutral paragraph this pull request changes. The design owners' own reviews still decide the merge. |
|
/approve-spec 1de402a |
There was a problem hiding this comment.
Changes requested: the new selected table row and command rules in Neutral, Butter and Y2K read at 4.5:1 or better on every ground the contrast guard builds, but one blocking finding remains.
- The INV22 known-gap paragraph in
docs/architecture/theme-compilation.mdand the description list only some of the grounds where a striped table's selected even rows still read under 4.5:1 (light Butter reads 3.61–4.14:1 in every coloured card, dark Butter 2.88:1 in a default card, dark Y2K down to 1.50:1 in every coloured card, light Y2K 4.42:1 in a pink card), and the description's "Core's own default already reads on Core's tint" does not hold inside Core's coloured cards (3.78:1 in a light gray card), so please state the full set; suggested wording is inline.
Approval also waits on the design owner's re-review: their earlier change request asked for existing palette steps that pass with hover and card backgrounds, which this head follows, but it stays open until they re-review. A non-blocking wording suggestion for the Butter and Y2K comment is inline. CI's heavy checks have not run on this head yet.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Before, a selected table row's supporting text read 3.47:1 in dark Neutral and 3.50:1 in dark Butter (2.85:1 hovered on a surface): verified (browser 3.47 and 3.50; 2.85 computed).
- After, every tinted part in the three themes reads at 4.5:1 or better on the page and the surface, and every part but the drop hint in every card, at rest and hovered, except striped even rows: verified (contrast guard passes; browser lowest 4.92:1).
- The three themes had rules for items, tree rows, citations and drop hints and none for table rows or commands: verified (base theme sources).
- The guard now checks every tinted part, nested cards and hover where the theme sets the text, so a missed part fails CI: verified (the head's guard fails on the base's themes).
- The earlier Core-computed shade gave off-palette values and was removed with its modules: verified (no Core theme module in this change).
- A theme cannot set Core's private variables: verified (the theme-compilation record's private-variable invariant).
- Core's own default already reads on Core's tint: false in part (5.07:1 or better on the page and the surface, 3.78:1 in Core's light gray card) — finding.
- Each theme adds the two rules with the stops it uses for selected items, and Butter and Y2K keep their coloured-card selectors: verified.
- Butter's light stop moves from 40 to 35 and Y2K's dark stop from 70 to 75; the old stops read 4.45:1 hovered on the page and 4.27:1 hovered in a muted card: verified.
- Core's palette mapping and its generated CLI copy lift the two parts, so palette-made themes and the editor do too: verified (generator check and palette tests).
- The CLI's bundled theme copies are regenerated: verified (byte-identical).
- The guard checks the table row and command, a default card inside a coloured card, and hover where the theme sets the text: verified.
- Without Neutral's table-row rule the guard fails at 3.47:1, and with Butter's old stop it fails hovered in a card: verified (4.16:1 in a muted card).
- Themes that set no tinted text are checked at rest: verified.
- Chromium lowest ratios per theme and mode: consistent with the guard (within 0.05 on the listed grounds).
- No other theme changes and no public API changes: verified (built API surfaces compare with no row).
- Not changed here, striped selected even rows: incomplete (light Butter, dark Butter's default card, more dark Y2K and light Y2K cards are missing) — finding.
- A drop hint inside a coloured card keeps its page stop in dark Butter and Y2K, and Matcha, Gothic, Stone and Chocolate do not pass hovered: consistent (no coloured-card drop hint rule; Stone dark is 4.50:1 at rest).
- The knowledge check passes and the record rubric holds: verified.
- The listed test suites and checks pass: verified.
- Changeset: a selected table row and command take the theme's tinted-state text, as items and tree rows do: verified.
- Changeset: in the three themes it is a palette stop at 4.5:1, at rest and hovered, on the page and surface and in every card for rows, commands and citations: verified.
- Changeset: striped even rows in Butter and Y2K keep the stripe's text: verified.
- Changeset: before, 3.47:1 in dark Neutral and 3.50:1 in dark Butter: verified.
- Changeset: the stop moves (40 to 35, 70 to 75) make the text read hovered in a muted card: verified (4.16:1 and 4.27:1 before).
- Changeset: palette-made themes lift the same two parts: verified.
- Changeset: patch bumps for Core, the CLI and the three themes: verified (changeset check passes).
Files:
.changeset/selected-rows-palette-stops.md: cleardocs/architecture/theme-compilation.md: finding (the striped-row known gap omits failing grounds)packages/cli/api/theme-edit/_palette.mjs: clearpackages/cli/api/theme/palette/generate/mapping.mjs: clear (generated, in sync with Core)packages/cli/assets/templates/themes/butter/butterPaletteRefs.generated.ts: clear (generated copy)packages/cli/assets/templates/themes/butter/butterTheme.ts: clear (generated copy)packages/cli/assets/templates/themes/neutral/neutralTheme.ts: clear (generated copy)packages/cli/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts: clear (generated copy)packages/cli/assets/templates/themes/y2k/y2kTheme.ts: clear (generated copy)packages/core/src/palette/mapping.ts: clearpackages/themes/butter/src/butterPaletteRefs.generated.ts: clear (in sync with its generator)packages/themes/butter/src/butterTheme.ts: clear (non-blocking comment wording)packages/themes/neutral/neutral.spec.md: clear (approved at this head)packages/themes/neutral/src/neutralTheme.test.ts: clearpackages/themes/neutral/src/neutralTheme.ts: clearpackages/themes/y2k/src/y2kPaletteRefs.generated.ts: clear (in sync with its generator)packages/themes/y2k/src/y2kTheme.ts: clear (non-blocking comment wording)scripts/check-text-contrast-by-role.test.mjs: clear
| the tint. INV22 does not hold there in Butter and Y2K: dark Butter reads 3.50:1 | ||
| on the page and 1.75–1.80:1 in a blue or yellow card; dark Y2K reads 1.56–1.73:1 | ||
| in those cards; light Y2K reads 4.47:1 on the page. The contrast guard does not | ||
| build a striped row. |
There was a problem hiding this comment.
This list leaves out grounds where the same rows read under 4.5:1 at this head: light Butter 3.61–3.90:1 in every coloured card and 4.31:1 in a muted card (3.85:1 blue and 3.61:1 yellow rendered in Chromium), dark Butter 2.88:1 in a default card and 3.22:1 on a surface, dark Y2K 1.50–1.76:1 in every coloured card, and light Y2K 4.42–4.47:1 in a pink or red card. As written, it reads as if light Butter's striped rows pass. Suggested:
INV22 does not hold there in Butter and Y2K: dark Butter reads 1.75–3.50:1 on
every ground (2.88:1 in a default card); light Butter reads 3.61–3.90:1 in a
coloured card and 4.31:1 in a muted card; dark Y2K reads 1.50–1.76:1 in a
coloured card; light Y2K reads 4.42–4.47:1 on the page and in a pink or red card.
The description's "Not changed here" list needs the same figures.
| * command, a dropzone's hint and a numbered citation. On the page it is the | ||
| * nearest stop that reads on the tint at rest and under a hover, over the | ||
| * page, a card and the muted fill. Inside a coloured card it is a dark stop, |
There was a problem hiding this comment.
Non-blocking: this sentence runs 28 words and says "page" twice. Suggested: "Over the page, a card or the muted fill, it is the nearest stop that reads on the tint at rest and hovered." The same comment is in y2kTheme.ts:35-37.
Record change:
architecture:theme-compilationgains INV22 (a part on the accent tint takes the theme's tinted-state text) with its verification row;verified_bylists the contrast guard.User impact
The supporting text of a selected table row reads under the 4.5:1 that body text needs: 3.47:1 in dark Neutral and 3.50:1 in dark Butter (2.85:1 hovered on a surface). With this change, every part on the accent tint in Neutral, Butter and Y2K (a selected item, tree row, table row and command, a numbered citation and a dropzone's hint) reads at 4.5:1 or better on the page and the surface, and every part but the dropzone also in every card, at rest and under a hover. The exception is every second row of a striped table in Butter and Y2K, which keeps the stripe's text (see "Not changed here").
Problem and solution fit
The fix keeps the themes' own palette stops, as the design owner asked ("All colors need to come from existing palette steps"). Each theme adds the two missing parts with the stops it already uses for selected rows. The contrast guard now checks every part on the tint, inside nested cards and, where a theme sets the part's text, under a hover, so a part a theme misses fails CI.
Why the measured shade was dropped
An earlier version of this pull request had Core compute the text on the tint: the least change to the theme's secondary text that reads at 4.5:1. That gave off-palette shades in every official theme (for example
#C4C4C4in dark Neutral, next to its own stop 80#c6c6c6). The design owner asked for existing palette stops instead. A theme cannot set Core's private--_*values (the theme build refuses them by design), so Core cannot take a stop from the theme through one shared variable either. Core's own default already reads on Core's tint, so the measured shade served only other themes. It is removed with its modules. The per-part rules stay, and the guard catches a part a theme misses.Expected behavior and authority
architecture:theme-compilationINV22 (proposed here): a part on the accent tint takes the theme's tinted-state text; where an official theme sets it, it is a stop of its own palette.theme:neutral: the selected-fill paragraph lists the two added parts, with the same stops (neutral.light[30]/neutral.dark[80]).theme:butterandtheme:y2kDEC-4: values come from named palette stops. The stops here are palette stops.Smallest restoration
table-rowandcommand-palette-itemselectedrules with the stops each theme already uses for selected items. Butter and Y2K keep their coloured-card selectors for them.packages/core/src/palette/mapping.ts(and its generated CLI copy): the official Neutral lift list addstable-rowandcommand-palette-itemselected, so themes made withdefineTheme({palette})and the theme editor lift the same parts.scripts/check-text-contrast-by-role.test.mjs: checks the selected table row and command, a default card inside a coloured card, and a part under a hover where the theme sets its text.Evidence
pnpm exec vitest run --project node scripts/check-text-contrast-by-role.test.mjs: passes. With Neutral'stable-rowrule removed, it fails at 3.47:1, so a missed part fails CI.Rendered in Chromium 149 at this head: each theme's generated stylesheet, in light and dark, on markup with the theme's part classes and states (
astryx-table-row,astryx-command-palette-itemandastryx-itemwithdata-selected="selected"), the accent tint as the part's fill, and the hover overlay over it, on the page and in a blue, yellow, muted and default card. All 180 cases read at 4.5:1 or better. Lowest secondary-text ratio per theme and mode (the same for table rows, commands and items):Owner review
architecture:theme-compilation(INV22 and its verification row) is approved by cixzhang: review requested from cixzhang.theme:neutral(the selected-fill paragraph) is approved by rubyycheung: review requested from rubyycheung.Scope
Core (the palette mapping), the CLI (the generated mapping and the bundled theme copies), and the Neutral, Butter and Y2K themes. No other theme changes. No public API changes.
Not changed here, and present on main: on a striped table, a theme's stripe rule outweighs its selected-row rule, so a selected even row of a striped table keeps the stripe's text on the tint: dark Butter 3.50:1 on the page and 1.75–1.80:1 in a blue or yellow card, dark Y2K 1.56–1.73:1 in those cards, light Y2K 4.47:1 on the page (Gothic also has a stripe rule). INV22 lists this under the record's known gaps. Writing the selected-row text again after the stripe rule is wrong for a table that selects without the wash (the row keeps its stripe fill), and CSS cannot tell the two apart without a private marker for the wash, which is a Core owner decision for a separate change. Also: a dropzone's hint inside a coloured card keeps its page stop in dark Butter and Y2K; Matcha, Gothic, Stone and Chocolate do not pass hovered on the tint. Each needs its own theme change.
Writing rubric results
Record rubric (
docs/contributing/spec-writing.md) over INV22, its verification row and the Neutral paragraph:pnpm check:knowledgepasses.Testing
pnpm exec vitest run --project ui packages/themes packages/core/src/theme packages/core/src/palette packages/core/src/Table packages/core/src/CommandPalettepnpm exec vitest run --project node packages/cli/api/theme-edit packages/cli/api/theme/palette scripts/check-text-contrast-by-role.test.mjs scripts/check-theme-template.test.mjspnpm check:knowledge,pnpm check:cli-palette-engine,pnpm check:neutral-palette-refs,pnpm check:butter-palette-refs,pnpm check:y2k-palette-refspreflight: pass 1de402a