Skip to content

fix(cli): experimental theme editor - a bar's text token is checked in the menus its items open - #13450

Merged
josephfarina merged 2 commits into
feature/theme-editorfrom
theme-editor-menu-text-check
Nov 21, 2026
Merged

josephfarina merged 2 commits into
feature/theme-editorfrom
theme-editor-menu-text-check

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A theme that gives a bar white text (--color-text-primary #ffffff --on app-shell-header, the same on top-nav or layout-header) also gives that white text to the menus and popovers its items open. Core draws a layer inside the element that opens it, so the menu inherits the bar's text tokens, while its surface keeps the popover fill (white). The result is white items on a white panel at 1:1. The editor's check measured only what is drawn inside the bar, so it reported nothing and gave no fix.

Now the check measures each text or icon token a bar sets on the popover fill, in each mode, and reports it below 4.5:1:

a menu or popover opened from app-shell-header, top-nav, layout-header draws its --color-text-primary (#ffffff) on the popover fill (#ffffff): 1.00:1 in light; text needs 4.5:1
  fix: astryx experimental theme editor set <theme> --color-text-primary '#000000' --on overlays --mode light

The fix declares the token on the overlays at the value the theme gives it elsewhere; a token declared on the popover beats the inherited one.

Size: one finding; about 120 lines of code (one new check function and its call) and 125 lines of tests and release note, so it stays one pull request.

Expected behavior and authority

No current record decides what the editor's contrast check measures; this is an [experimental] patch (spec:AST-017 FR22). The reading (a layer opened from a bar is checked as drawn inside it, with the fix on the overlays) needs an engineering owner's decision on this pull request.

Scope

  • packages/cli/api/theme-edit/_settings.mjs: layerTextProblems, beside scopedFillPairProblems. A bar is a part that holds a bar row, or that row (barRows). A setting for the part alone (--only), a token the theme already sets on the popover family, and the disabled text and icon tokens (exempt from 4.5:1, as in the text pairs' check) are left out. Lines for one token and mode are joined, naming each bar.
  • packages/cli/api/theme-edit/theme-layer-text-reach.test.mjs: the header settings of three first-try themes whose header menus drew white on white (reported, with the fix line); the fix on the overlays, a token set on the popover, a disabled token on a bar, a white token on a card (no bar), and a dark token on inputs (all clean).
  • .changeset/theme-editor-menu-text-check.md.

Testing

  • npx vitest run packages/cli/api/theme-edit/theme-layer-text-reach.test.mjs --project node: 2 pass; the first fails without the change (the second, that the clean cases stay clean, passes on the base too).
  • packages/cli/api/theme-edit node tests: 563 of 564 files pass; the one failure (theme-build-names-pictures-removed) fails the same way on the base on this machine.
  • tsc --project tsconfig.api-dts.json (packages/cli): clean.
  • eslint and prettier clean.

replay: worse 0 at fc6febb

preflight: pass fc6febb

…n the menus its items open

Core draws a layer inside the element that opens it, so a menu opened
from a bar inherits the bar's text tokens while its surface keeps the
popover fill. The check measures that token on the popover fill and
gives the fix on the overlays.
@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 21, 2026 7:05pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 21, 2026
@astracat-bot

astracat-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 21, 2026, 7:12 PM UTC

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1485b20

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the new check catches real white-on-white header menus, but this head breaks the CLI typecheck and flags disabled text the editor otherwise exempts.

  • packages/cli/api/theme-edit/_settings.mjs:13867 and :13869 pass the found map's text and fill (typed number[] at :13820) where an Rgb tuple is required, so tsc --project tsconfig.api-dts.json, the declaration step at the end of pnpm build, fails with two TS2345 errors at this head while it passes on the base; typing both fields as [number, number, number] fixes it.
  • The token filter at _settings.mjs:13824 also measures --color-text-disabled and --color-icon-disabled, which the editor's text check exempts from 4.5:1 (packages/cli/api/theme-edit/_compiler.mjs:828-831), so a dim disabled colour on a dark header now reports "text needs 4.5:1" and its fix replaces the theme's disabled grey in every dialog, drawer, popover and menu; skip those two tokens, or offer the theme's own value without the 4.5:1 floor.
  • The description says both new tests fail without the change, but on the base only the first fails and the second (all toEqual([])) passes; please correct that sentence.

Two small non-blocking notes are in the list below.

Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • Changeset: a text or icon token on a bar reaches the menus and popovers its items open, because a layer renders inside its opener: verified (the layer-runtime record keeps a layer at its JSX position with live custom-property inheritance; every popover surface carries the popover target, usePopover.tsx:972-976).
  • Changeset: the check measures that token on the popover fill, reports it below 4.5:1 and fixes it on the overlays: verified (_settings.mjs:13822-13874, new test), though it also measures the disabled tokens (blocking item 2).
  • Changeset and body: before, a white-text header's menus drew white on white with nothing reported: verified (the new test's first case fails on the base with no line).
  • Body: the menu keeps the popover fill, giving 1.00:1, with the quoted line and fix: verified (usePopover.tsx:116; the test asserts the exact line and fix and passes).
  • Body: the fix uses the value the theme gives the token elsewhere: partly true; when that value is under 4.5:1 on the fill the fix is the nearest colour that reads instead (_settings.mjs:13866-13869).
  • Body: no current record decides what the editor's contrast check measures, and the change is an experimental patch: verified; the changeset is an experimental patch for the CLI.
  • Body: a bar is a part holding a bar row, or that row: verified (_settings.mjs:13784-13789).
  • Body: settings for the part alone, and tokens already set on the popover family, are left out: verified in code (:13823, :13830-13839); the part-alone case cannot occur on a bar (note 1).
  • Body: lines for one token and mode are joined, naming each bar: verified (:13856-13861; the test's three-bar line).
  • Body: the test covers the reported header settings and four clean cases: verified (test file).
  • Body: the new test file passes 2 of 2: verified; both fail without the change: false (blocking item 3).
  • Body: 563 of 564 editor node test files pass: not rerun in full; the 22 existing files that set text tokens on bars pass at this head (1,204 tests).
  • Body: eslint and prettier are clean: verified for the changed files; the strict typecheck is not (blocking item 1).

Files:

  • .changeset/theme-editor-menu-text-check.md: clear (experimental patch).
  • packages/cli/api/theme-edit/_settings.mjs: blocking items 1 and 2; note 1: the x.only skip at :13823 never applies to a bar, because the settings reader drops only on a part styled on its own; note 2: inMode and inScope copy the closures in scopedFillPairProblems, the sixth copy of inMode in this module, so one shared helper would keep a parsing fix from missing a copy.
  • packages/cli/api/theme-edit/theme-layer-text-reach.test.mjs: clear; the second case guards the clean results and is not red-first.

Automated review (maintainer link)

… and leaves disabled text out

The joined colors are typed as the RGB tuples the measure takes, so the
API declarations build. Disabled text and icon tokens are exempt from
4.5:1, as the text pairs' check exempts them.
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec fc6febb

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: the new check reports a bar's light text colour in the menus it opens, and the typecheck error, the disabled-text check and the test claim from the last review are all fixed on this head.

Two small non-blocking notes for a follow-up are in the file list below.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Changeset: a text or icon colour set on a bar also reaches the menus and popovers its items open, because a layer renders inside its opener: verified (the layer-runtime record keeps a context layer at its position with live custom-property inheritance; every popover surface carries the popover theme target, packages/core/src/Popover/usePopover.tsx:972-975).
  • Changeset: the check measures that colour on the popover fill, reports it below 4.5:1 and fixes it on the overlays: verified (packages/cli/api/theme-edit/_settings.mjs:13822-13881, first test); disabled text and icon colours are skipped under the editor's standing disabled-text exemption (:13824-13829), which the release note leaves unsaid.
  • Changeset and description: before, a white-text header's menus drew white on white with nothing reported: verified (the first test fails on the base with no line).
  • Description: the menu keeps the popover fill, giving 1.00:1, with the quoted line and fix: verified (the first test asserts the exact line and fix and passes).
  • Description: the fix declares the colour on the overlays at the value the theme gives it elsewhere, and a colour on the popover beats the inherited one: verified (#000000 is the base theme's own light primary text; the overlays and popover cases in the second test come back clean); when the theme's own value does not reach 4.5:1, the fix is the nearest colour that does (:13870-13874).
  • Description: about 120 lines of code and 125 of tests and release note: verified approximately (125 and 130).
  • Description: no current record decides what the check measures, and the change is an experimental patch: verified; an engineering owner recorded the decision for this head.
  • Description: a bar is a part that holds a bar row, or that row: verified (:13784-13789).
  • Description: settings for the part alone, colours already set on the popover family, and the disabled text and icon colours are left out: verified (:13823-13831, :13835-13844); the part-alone case cannot occur on a bar (note 1).
  • Description: lines for one colour and mode are joined, naming each bar: verified (:13861-13866; the three-bar line in the first test).
  • Description: the test covers the reported header settings and five clean cases: verified (test file; the disabled case at lines 108-112).
  • Description: the new test file passes 2 of 2, the first fails without the change, and the second passes on the base too: verified.
  • Description: 563 of 564 editor test files pass: not rerun in full; this head only narrows which colours the check reads, and no other test names its lines.
  • Description: the CLI declaration typecheck is clean: verified.
  • Description: eslint and prettier are clean: verified for the changed files.

Files:

  • .changeset/theme-editor-menu-text-check.md: clear.
  • packages/cli/api/theme-edit/_settings.mjs: clear; note 1: the x.only skip at :13823 never applies to a bar, because the settings reader drops a saved only on a part styled on its own; note 2: inMode and inScope copy the closures in scopedFillPairProblems, one of six inMode(v, m) copies in this module, so one shared helper would keep a parsing fix from missing a copy.
  • packages/cli/api/theme-edit/theme-layer-text-reach.test.mjs: clear; the new disabled case shows its effect in dark mode, where the same colour on a live text token reports 2.49:1.

Automated review (maintainer link)

@josephfarina
josephfarina marked this pull request as ready for review November 21, 2026 20:01
@josephfarina
josephfarina merged commit a64efa7 into feature/theme-editor Nov 21, 2026
9 checks passed
josephfarina added a commit that referenced this pull request Nov 21, 2026
…n the menus its items open (#13450)

Reviewed pull request #13450, merged into the theme working branch. It reaches main with the branch's next landing.
josephfarina added a commit that referenced this pull request Nov 21, 2026
- #12787 experimental theme: a pressed or hovered part's flat tint is measured as the fill it is
- #13252 experimental theme: a one-color layer is a fill only where it covers the whole box
- #13300 experimental theme: a fill and its on-color set inside a part are measured as that part draws them
- #13321 experimental theme: a part's fill pair is measured though its on-color is set for the whole theme
- #13360 experimental theme: an on-color set on a part holding the readers leaves the fill pair out
- #12768 feat(cli): experimental theme editor show <theme> --on <part> gives what one part of a theme shows
- #13057 experimental theme pictures: sheet cells are never narrower than what they hold, and a panel over the page is drawn at its cell's full width
- #13200 experimental theme pictures: a change removes the pictures cut from a tall one
- #13199 experimental theme pictures: the pages section draws the sample app whole, cut between pages and named
- #13320 fix(cli): corners said before their edge run after it, so the whole answer does both
- #13375 experimental theme how: a clashing fill's text color goes in that fill's choice
- #13411 experimental theme how: a clash with a see-through fill joins its text too; another look's text leaves it joined
- #13420 fix(cli): experimental theme editor - glossy writes no sample gradient
- #13452 test(cli): the said-order test reads a named corner as that corner
- #13262 fix(cli): experimental theme editor - an ask that starts with clear the and names only removable looks takes them away
- #13450 fix(cli): experimental theme editor - a bar's text token is checked in the menus its items open
- #13442 feat(cli): a light neutral also fills the page, surface and card backgrounds in light mode
- #13477 docs(changeset): the clear reading takes looks away for one part
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed on main in #13470.

@github-actions
github-actions Bot deleted the theme-editor-menu-text-check branch November 22, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — fc6febba Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant