Skip to content

fix(core): Field labels use the primary text colour - #12458

Closed
josephfarina wants to merge 2 commits into
mainfrom
rl-43a-label-color
Closed

josephfarina wants to merge 2 commits into
mainfrom
rl-43a-label-color

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Record change: none (one shared colour token for another, inside component:FieldLabel). Look gate: themed form-page audit 0 new findings in all seven themes; template sweep 0 worse; blind visual judge 2 better, 0 worse; contrast table below.

Its base, #12428 (label weight), has merged; this PR now targets main and changes only the label colour.

User impact

In forms built with Field (text inputs, selectors, date and time inputs, checkbox and radio lists), the label used --color-text-secondary, the same colour as the description under it. Next to a hand-written form, Astryx labels read faint grey, and the label and its description shared one colour.

This PR draws the label in --color-text-primary. The label names the control, so it reads at full strength; the description and the Optional or Required marker keep --color-text-secondary and read as supporting text.

Visual authority

  • Existing component/module DD row reused or amended.
  • Durable component-local intent added to the optional Design decisions table by a team design owner.
  • Correction already settled by current family, design, theme, or objective accessibility authority.
  • New shared or cross-component direction settled in docs/design/.

component:FieldLabel and component:Field say no design record governs component-local visual tuning and that the label uses shared semantic colour tokens. This change stays inside that: one shared text token for another. No record is edited. The FieldLabel record owner's review settles the tuning.

Before and after

Chromium on Linux, Storybook Field "All variations" story. Each image: top row before, bottom row after; columns are phone 390px light and dark, phone 375px light and dark, desktop 1280px (left part) light and dark.

Core defaults (no theme)
Core defaults before and after

Neutral
Neutral before and after

Stone
Stone before and after

Butter
Butter before and after

Chocolate
Chocolate before and after

Gothic (dark-only theme; the light column shows its dark palette)
Gothic before and after

Matcha
Matcha before and after

Y2K
Y2K before and after

Contrast

Label text against the surface behind it, measured from the rendered page (WCAG ratio). The description column is unchanged by this PR and equals the old label value, because the label and the description used one colour before.

Theme Mode Label before Label after Description (unchanged)
Core defaults light 6.51:1 18.78:1 6.51:1
Core defaults dark 9.51:1 16.15:1 9.51:1
Neutral light 9.29:1 21:1 9.29:1
Neutral dark 5.65:1 15.13:1 5.65:1
Stone light 6.35:1 15.25:1 6.35:1
Stone dark 7.51:1 15.13:1 7.51:1
Butter light 6.45:1 17.12:1 6.45:1
Butter dark 6.81:1 13.83:1 6.81:1
Chocolate light 6.55:1 11.27:1 6.55:1
Chocolate dark 7.91:1 14.21:1 7.91:1
Gothic light 7.03:1 16.3:1 7.03:1
Gothic dark 7.03:1 16.3:1 7.03:1
Matcha light 5.88:1 9.77:1 5.88:1
Matcha dark 8.46:1 10.13:1 8.46:1
Y2K light 7.78:1 15.22:1 7.78:1
Y2K dark 7.91:1 15.3:1 7.91:1

Look gate on every theme

The phone and dark audit (overflow, clipping, text overlap, WCAG contrast, scheme, reachable controls, and up to three opened menus or dialogs per view) ran on the 16 form pages and form blocks among the templates (sign-in, contact, settings, payment, checkout and form wizards, drawer form), rendered with this PR's base (#12428, now merged) and with this PR, each theme's CSS applied, at 390px and 1280px, light and dark. Planted controls (a page that must pass and a low-contrast page that must fail) came out right in every theme.

Theme Failing views, base Failing views, this PR New findings
Neutral 0 0 0
Stone 0 0 0
Butter 0 0 0
Chocolate 2 2 0
Gothic 26 26 0
Matcha 4 4 0
Y2K 4 4 0

The existing failures are the same on both sides (Gothic is a dark-only theme, so its light views fail by design).

A theme's own label colour wins

The label colour stays on the field-label theme target, so a theme that styles that target keeps its colour. The Probe test theme sets its own field-label colour; the label renders rgb(52, 38, 9) before and after this PR, in light and dark.

Probe theme keeps its label colour

State matrix

  • Themes: Core defaults and all seven first-party themes, light and dark. No first-party theme styles the field-label target, so each moves the same way; a theme that styles it keeps its own colour.
  • Widths: 375px, 390px and 1280px.
  • Unchanged: the description, the Optional and Required marker, status messages, the disabled label (--color-text-disabled still applies after the base colour), and hidden labels.

Scope

Components: FieldLabel

  • Appearance is the primary intent.
  • Behavior, API, interaction model, and unrelated layout changes were removed or split.
  • The evidence shows the changed pixels actively running, not only source or computed styles.
  • Public text and artifacts contain no internal Meta context.

Testing

  • FieldLabel.test.tsx: a new test reads the injected CSS and pins the label to --color-text-primary and the description and marker to --color-text-secondary. It fails on the old style.
  • CI=1 vitest run packages/core/src/Field packages/core/src/FormLayout packages/core/src/CheckboxInput packages/core/src/Switch packages/core/src/theme/themingTargets.test.ts (23 files, 920 passed).
  • Phone and desktop template sweep: 82 template pages and blocks rendered at 390px in light and dark, with 9 planted controls (9 caught): 0 pages worse, 0 better, same score before and after (render and dev app).
  • Blind visual judge, six agent-built RSVP forms against hand-written pages for the same request (both orders, a win only when both agree): 2 pages better (tie → win, loss → tie), 0 worse. Head to head, the primary-colour label wins or ties every page against the secondary one.

preflight: pass 2f18395

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

vercel Bot commented Nov 17, 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 19, 2026 3:24am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 3:34 AM UTC

@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.

Approval waits on an engineering owner's decision about the label colour, and the changeset needs one wording fix.

  • No current record decides that FieldLabel's label text (every Field label, the standalone CheckboxInput and Switch labels, and a label's icon) moves from the secondary to the primary text colour while the description and the Optional/Required marker stay secondary; an engineering owner records that decision, or points to the record that settles it, by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
  • The changeset says only the weight told the label and its description apart before, but the base also sets them at different sizes (14px and 12px in the default theme), so line 5 should read "Before, the label and its description shared one colour.", and the description's "differ only in weight" needs the same edit.

The new test fails on the base and passes here, the Field, FormLayout, CheckboxInput, Switch and theming-target suites pass, and the label contrast measured in Core light, Neutral light and dark, Matcha light and Gothic dark matches your table, while Core dark measured 8.48:1 to 14.4:1 against the story's page background.

Claims and files checked

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

  • Changeset: labels use the primary text colour while the description and the marker stay secondary: verified (FieldLabel.tsx:77, :131, :138; new test)
  • Changeset: before, the label and its description shared one colour: verified (both secondary on the base)
  • Changeset: before, only the weight told them apart: false (base sizes 14px and 12px)
  • Description: no knowledge record changes: verified
  • Description: stacked on the label-weight pull request: verified (this branch's base is that pull request's head)
  • Description: label and description differed only in weight: false (sizes differ)
  • Description: no published theme styles the label target, and a theme that does keeps its colour: verified (only the private test theme styles it; the target still composes)
  • Description: description, marker, status messages, disabled and hidden labels unchanged: verified
  • Description: the new test pins the colours and fails on the old style: verified (fails on the base, passes on the head)
  • Description: the stated test command passes, 23 files and 920 tests: verified
  • Description: contrast table: verified for Core light, Neutral light and dark, Matcha light and Gothic dark; Core dark measured 8.48:1 to 14.4:1; other rows not measured
  • Description: template sweep and blind visual judge: not reproducible here, not relied on
  • .changeset/field-label-primary-color.md: finding (line 5)
  • packages/core/src/Field/FieldLabel.test.tsx: clear
  • packages/core/src/Field/FieldLabel.tsx: clear apart from the colour decision above

Automated review (maintainer link)

Comment thread .changeset/field-label-primary-color.md Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): field labels draw in the primary text color, while the description and the Optional or Required marker stay in the secondary color. This covers every Field label, the standalone CheckboxInput and Switch labels, and a label's icon. It raises the label's contrast, and the label color stays a theme setting on the field-label target, so a theme that sets its own label color keeps it.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec aad9a0e

@josephfarina

Copy link
Copy Markdown
Contributor Author

@astracat-bot review

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8780105

@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 pending CI: CI has not run on this head yet, because it runs only once this pull request targets main.

The label colour change has an engineering owner's decision on this pull request, the earlier changeset wording is fixed, and the new colour test fails on the base and passes here.

  • Optional: the changeset says "Field labels", but the standalone CheckboxInput and Switch labels also turn primary; naming them tells people using those controls to expect it.
Claims and files checked

Review mode: full; reason: rebase

  • Changeset: labels use the primary text colour while the description and the Optional or Required marker stay secondary: verified (FieldLabel.tsx:77, :131, :138; new test)
  • Changeset: before, the label and its description shared one colour: verified (both secondary on the base)
  • Description: no knowledge record changes: verified (three files, none a record)
  • Description: stacked on the label-weight pull request: verified (this branch's base is that branch)
  • Description: the label moves to the primary colour while the description and the marker keep the secondary one: verified
  • Description: a theme that styles the label target keeps its colour, and the Probe theme renders rgb(52, 38, 9) before and after: verified (pixel-identical frames)
  • Description: no first-party theme styles the label target: verified (only the Probe test theme does)
  • Description: description, marker, status messages, disabled and hidden labels unchanged: verified (the disabled label keeps the disabled colour in the States story)
  • Description: the new test pins the colours and fails on the old style: verified (fails on the base, passes here)
  • Description: the stated test command passes, 23 files and 920 tests: verified
  • Description: contrast table: verified for 15 of 16 rows; the Core defaults dark row matches a black page, while on the browser's default dark page it measures 8.48:1 to 14.4:1
  • Description: before and after images, theme audit, template sweep and blind visual judge: not reproduced here and not relied on
  • .changeset/field-label-primary-color.md: clear (optional wording note above)
  • packages/core/src/Field/FieldLabel.test.tsx: clear
  • packages/core/src/Field/FieldLabel.tsx: clear

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 2f18395

@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 pending CI: CI has not run on this head yet, because its latest commit message carries [skip ci]; the required checks still have to run and pass before merge.

The label colour change has an engineering owner's decision on this pull request, the rebase onto main left the colour commit unchanged, and the new colour test fails on the old style and passes here.

  • Optional: the changeset says "Field labels", but the standalone CheckboxInput and Switch labels also turn primary; naming them tells people using those controls to expect it.
Claims and files checked

Review mode: full; reason: rebase

  • Changeset: labels use the primary text colour while the description and the Optional or Required marker stay secondary: verified (FieldLabel.tsx:77, :131, :138; new test)
  • Changeset: before, the label and its description shared one colour: verified (both secondary on the base)
  • Description: no knowledge record changes: verified (three files, none a record)
  • Description: stacked on the label-weight pull request, changing only the label colour on top of it: verified (the label weight is already on main under this branch, and only the colour changes here)
  • Description: the label moves to the primary colour while the description and the marker keep the secondary one: verified
  • Description: the FieldLabel and Field records leave component-local visual tuning to shared semantic tokens: verified
  • Description: a theme that styles the label target keeps its colour, and the Probe theme renders rgb(52, 38, 9) before and after: verified (pixel-identical frames, light and dark)
  • Description: no first-party theme styles the label target: verified (only the Probe test theme does)
  • Description: description, marker, status messages, disabled and hidden labels are unchanged: verified (only the label rule changes; the disabled label measures 3.15:1 on both sides)
  • Description: the new test pins the colours and fails on the old style: verified (fails on the base, passes here)
  • Description: the stated test command passes: verified (24 files and 921 tests at this head; the stated 23 and 920 were counted before the rebase)
  • Description: contrast table: verified for 15 of 16 rows; Core defaults dark measures 8.48:1 to 14.4:1 on the browser's default dark page
  • Description: no API or behaviour change: verified (built API surface identical)
  • Description: phone-width images, theme audit, template sweep and blind visual judge: not reproduced here and not relied on
  • .changeset/field-label-primary-color.md: clear (optional wording note above)
  • packages/core/src/Field/FieldLabel.test.tsx: clear
  • packages/core/src/Field/FieldLabel.tsx: clear

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12635 fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names
  Author: @josephfarina
- #12727 fix(cli): export loads a served package's subpath exported only to imports
  Author: @josephfarina
- #12224 fix(cli): a {@link} in a template description resolves as astryx docs resolves it
  Author: @josephfarina
- #12278 fix(core): a Theme given a value that is not a theme keeps the page running
  Author: @josephfarina
- #12751 feat(Layout): LayoutContent names its container, so a theme styles a dialog's body apart from its header and footer
  Author: @josephfarina
- #12168 fix(templates): header, footer and toolbar rows wrap for longer translated labels
  Author: @josephfarina
- #12399 [experimental] export: the dropped-text warning checks Core's docs, and text not drawn yet inside Core components that take children no longer warns
  Author: @josephfarina
- #12541 [docs] Core: list the props ComplexSelector, Selector, Toast and ContextMenuItem take
  Author: @josephfarina
- #12676 docs(cli): a short form keeps its own 640 column inside a wide template frame
  Author: @josephfarina
- #12458 fix(core): Field labels use the primary text colour
  Author: @josephfarina
- #12373 [experimental] export: a link to a place in the page stays in the file in a srcdoc viewer frame
  Author: @josephfarina
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12827.

@github-actions
github-actions Bot deleted the rl-43a-label-color branch November 20, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — 2f18395f Deployed Nov 19, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant