Skip to content

feat(core): buttons, inputs and textareas inherit letter-spacing - #7531

Closed
vjeux wants to merge 3 commits into
meta:mainfrom
vjeux:reset-control-letter-spacing
Closed

vjeux wants to merge 3 commits into
meta:mainfrom
vjeux:reset-control-letter-spacing

Conversation

@vjeux

@vjeux vjeux commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

User impact

@astryxdesign/core/reset.css makes form controls inherit their parent's font and color, but the browser sets letter-spacing: normal on them and letter-spacing is not part of font. Inside tracked text, such as an uppercase toolbar, a control's text keeps the default spacing. With this change buttons, inputs and textareas take the tracking around them; a control with its own letter-spacing keeps it. A select keeps the browser's spacing: Firefox does not widen a select for letter-spacing, so a tracked label would be clipped. No Astryx component tracks a container of native controls.

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

None applies yet: no current record governs what reset.css declares (spec:AST-080 governs only its layer). The owner decision: whether the reset's control typography includes letter-spacing, as Tailwind Preflight's does, and whether selects should track despite Firefox. Until then the changeset is a patch [feat] (spec:AST-017 FR3, DEC-17); recorded authority would make it [fix]. Escape: @layer reset { button, input, textarea { letter-spacing: normal; } }.

Before and after

Chromium 149, a toolbar tracked 0.2em, on main and on this branch.

main this branch
Toolbar on main: tracked heading, untracked controls Toolbar on this branch: input and button tracked, select unchanged

State matrix

  • Input, button and textarea track; a control's own letter-spacing still wins.
  • A select, its options and a listbox's optgroup keep normal. Tracked, a Firefox 151 select stays 92px wide while its label needs 103px ("All statu").
  • Date, time, number and file inputs widen without clipping in Chromium 149 and Firefox 151.
  • Engines: Chromium 149 and Firefox 151 on this head; WebKit 26.5 and real Safari 18.6 and 26.2 matched on the earlier rule.
  • Escape: matches main in both engines for plain controls, a themed control, and a self-tracked listbox.
  • Unchanged: Astryx components.

Scope

  • 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

  • pnpm exec playwright test packages/core/src/reset.letter-spacing.a11y.browser.spec.ts --project=chromium: 3 passed; the inherit test fails with main's reset.css. CI runs Chromium only; Firefox 151 was checked locally with Playwright.
  • pnpm exec playwright test packages/core/src/reset.a11y.chromium.spec.ts --project=chromium: 6 passed.
  • pnpm vitest run packages/core/src/reset.letter-spacing.test.ts packages/core/src/reset.test.ts packages/core/src/reset.until-found.test.ts .github/scripts/pages-landing.test.mjs: 19 passed; the inherit guard fails on main.
  • The pre-commit hook (lint-staged and pnpm check:repo, check:changesets included) and pnpm -F @astryxdesign/core typecheck pass.

@vercel

vercel Bot commented Oct 14, 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 Oct 22, 2026 7:47pm UTC

Request Review

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

astracat-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 23, 2026, 9:08 PM UTC

@vjeux

vjeux commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Real Safari check (iOS simulators, Safari 18.6 and Safari 26.2): input, button, select and textarea under a letter-spacing: 3px parent compute normal with main's reset and 3px with this branch's, in both versions.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

46 of 494 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 26 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

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

Thanks — the change works: under the reset, native form controls now pick up their container's letter-spacing, and a control that sets its own spacing keeps it. Approval needs a maintainer decision, because no current spec governs what reset.css declares (AST-080 covers only its cascade layer): a maintainer needs to approve or reject making form controls inherit letter-spacing and provide or identify the spec that governs the reset's form-control typography. Separately, unless that spec sets a different compatibility rule for the reset, please re-tag the Changeset as a patch [feat] (or [fix] if the spec is recorded first): AST-017 FR3 and FR54 treat an appearance-only change to the reset as nonbreaking, and the [breaking] tag is what fails check:changesets. When you rebase, recompute the Pages manifest hash for reset.css, because main has changed the reset since this branch was cut.

[Automated review]

Comment on lines +2 to +5
'@astryxdesign/core': minor
---

[breaking] Under `reset.css`, form controls (`button`, `input`, `optgroup`, `select`, `textarea`) now inherit `letter-spacing` from their parent, as they already inherit its font and color. The browser's stylesheet sets `letter-spacing: normal` on them, and `letter-spacing` is not part of `font`, so text in a control ignored any tracking set on its container. A page with letter-spacing on a container of native controls now sees it in those controls too.

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.

AST-017 classifies a typography-only change like this one as nonbreaking. FR3 says it "uses [fix] when it restores current visual authority and [feat] when it intentionally changes visual direction". FR32's [breaking] path needs pre-existing current authority, which the PR description says doesn't exist for reset.css. Once a maintainer settles the reset's control typography, a patch bump with the FR3 tag lets check:changesets pass on 0.7.1. The old/new spacing and the letter-spacing: normal escape can stay as written.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in c4a8bd6: the changeset is now a patch [feat] under FR3, since no current record governs the reset's form-control typography; recorded authority would make it [fix]. The old and new spacing stay as written, and the escape is now an exact rule, button, input, optgroup, select, textarea { letter-spacing: normal; }, which computes normal again in Chromium 149. Rebased on main with the Pages copy and hash regenerated; check:changesets passes. The description follows the visual-update template, with before and after screenshots.

@vjeux vjeux changed the title fix(core)!: form controls inherit letter-spacing like the rest of their font feat(core): form controls inherit letter-spacing like the rest of their font Oct 20, 2026
@vjeux
vjeux force-pushed the reset-control-letter-spacing branch from aad645c to c4a8bd6 Compare October 20, 2026 14:14

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

Thanks — the change works: under the reset, native form controls now take their container's letter-spacing, a control with its own spacing keeps it, and the patch [feat] Changeset and the Pages hash are in order. Approval needs a maintainer decision, because no current spec governs what reset.css declares (AST-080 covers only its layer and loading): a maintainer needs to approve or reject making form controls inherit letter-spacing and provide or identify the spec that governs the reset's form-control typography. Separately, please scope the Changeset's opt-out to the reset layer, for example @layer reset { button, input, optgroup, select, textarea { letter-spacing: normal; } }, because as ordinary unlayered CSS it also overrides letter-spacing a theme sets on the control itself, such as the theme template's destructive small Button, which the old reset left alone.

[Automated review]


[feat] Under `reset.css`, form controls (`button`, `input`, `optgroup`, `select`, `textarea`) now inherit `letter-spacing` from their parent, as they already inherit its font and color. The browser's stylesheet sets `letter-spacing: normal` on them, and `letter-spacing` is not part of `font`, so a control's text kept the default spacing inside tracked text. Controls inside a container with letter-spacing now show that tracking. Astryx's components look the same: none sets letter-spacing on a container of native controls.

To keep the old spacing, add `button, input, optgroup, select, textarea { letter-spacing: normal; }`.

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.

As ordinary (unlayered) CSS, this rule also overrides letter-spacing that a theme sets on the control itself, for example the theme template's variant:destructive+size:sm Button (0.02em), which the old reset left alone, so it doesn't fully keep the old look. Scoping it to the reset layer restores the old values for both themed and unthemed controls:

@layer reset {
  button, input, optgroup, select, textarea { letter-spacing: normal; }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 6d7621a. The escape is now @layer reset { button, input, optgroup, select, textarea { letter-spacing: normal; } }. In Chromium 149, with it added, plain controls under a tracked parent compute normal, and a control whose letter-spacing comes from the astryx-theme layer keeps its 0.02em, both as on main; the unlayered version reset that control to normal. The description says the same.

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

Thanks — the change works: native form controls now take their container's letter-spacing, and the layered opt-out keeps a theme's spacing on a control. Approval needs a maintainer decision, because no current spec governs what reset.css declares (AST-080 covers only its layer and loading): a maintainer needs to approve or reject making form controls inherit letter-spacing, say whether select and optgroup are included, and provide or identify the spec that governs the reset's form-control typography. If it goes ahead, two fixes are needed:

  • In Firefox 151 a content-sized native select under a tracked container keeps its width while its label gains the tracking, so the label is clipped ("All statuses" shows as "All status"); leaving select out of the new declaration avoids this, unless a maintainer decides selects should track anyway.
  • Chromium and Firefox leave optgroup to inherit from its select, so the Changeset's opt-out should drop it, @layer reset { button, input, select, textarea { letter-spacing: normal; } }, because as written it strips a select's own tracking from its group labels and options, which the old reset never did.

[Automated review]

Comment thread packages/core/src/reset.css Outdated
*/
:where(button, input, optgroup, select, textarea) {
font: inherit;
letter-spacing: inherit;

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.

In Firefox 151 this makes a content-sized native select under tracked text clip its label: an unstyled select under a 0.15em container keeps its 110.3px width while its tracked label alone needs 121.1px, so "All statuses" shows as "All status". Chromium 149 widens the same select from 106 to 135px. Leaving select out of this declaration, for example with a separate :where(button, input, textarea) { letter-spacing: inherit; }, keeps selects as they are today, unless a maintainer decides selects should track anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 2535bec: select is out. The declaration is now its own rule, :where(button, input, textarea) { letter-spacing: inherit; }, and the form rule is back to main's. I reproduced the clipping in Firefox 151 first: under a 0.15em container an unstyled select stayed 92.1px wide while its tracked label needed 102.9px, and it showed "All statu". On this head it renders as on main, in Chromium 149 too. Date, time, number and file inputs widen for the tracking in both engines without clipping. The comment above the rule and the changeset say why a select keeps the browser's spacing, and the browser spec now checks that a select, its option and a listbox's optgroup compute normal.


[feat] Under `reset.css`, form controls (`button`, `input`, `optgroup`, `select`, `textarea`) now inherit `letter-spacing` from their parent, as they already inherit its font and color. The browser's stylesheet sets `letter-spacing: normal` on them, and `letter-spacing` is not part of `font`, so a control's text kept the default spacing inside tracked text. Controls inside a container with letter-spacing now show that tracking. Astryx's components look the same: none sets letter-spacing on a container of native controls.

To keep the old spacing, add `@layer reset { button, input, optgroup, select, textarea { letter-spacing: normal; } }`. In the `reset` layer, it still yields to spacing a theme or your own styles set on a control.

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.

Chromium and Firefox leave optgroup to inherit from its select, so listing it here strips a select's own tracking from its group labels and options: in a listbox whose own CSS tracks it 0.2em at 16px, they compute 3.2px with the old reset and normal with this opt-out. @layer reset { button, input, select, textarea { letter-spacing: normal; } } matches the old reset in every case checked in Chromium 149 and Firefox 151. The same applies to "The browser's stylesheet sets letter-spacing: normal on them" on line 5, which holds for four of the five elements.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 2535bec. With select out of the rule, the opt-out lists exactly what the rule changes, @layer reset { button, input, textarea { letter-spacing: normal; } }, and line 5 now names only button, input and textarea, the elements the browser does set to normal. In Chromium 149 and Firefox 151 it computes as on main for plain controls under a tracked parent, for a control whose spacing comes from the astryx-theme layer, and for a listbox select that tracks itself at 0.2em: its optgroup and option keep 3.2px. With the old opt-out they computed normal, as you found.

@vjeux vjeux changed the title feat(core): form controls inherit letter-spacing like the rest of their font feat(core): buttons, inputs and textareas inherit letter-spacing Oct 20, 2026
@vjeux
vjeux force-pushed the reset-control-letter-spacing branch from 6d7621a to 2535bec Compare October 20, 2026 16:40

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

Thanks — both earlier fixes are in: select now keeps the browser's spacing, so Firefox no longer clips a tracked select, and the Changeset's opt-out restores the old look exactly, including a theme's or a listbox's own tracking. Approval now waits on a maintainer decision, because no current spec governs what reset.css declares (AST-080 covers only its layer and loading): a maintainer needs to approve or reject making button, input and textarea inherit letter-spacing, and provide or identify the spec that states it. Nothing else needs to change on your side.

[Automated review]

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

Thanks — the rebase keeps both earlier fixes, and the change works as described: under the reset, button, input and textarea now take their container's letter-spacing, select keeps the browser's spacing, and the Changeset's opt-out restores the old rendering exactly in Chromium and Firefox. Approval still waits on a maintainer decision, because no current spec governs what reset.css declares (AST-080 covers only its layer and loading): a maintainer needs to approve or reject making these three controls inherit letter-spacing, and provide or identify the spec that states it. Separately, the failing pr-a11y check runs a test that main added after this branch's base, so rebasing onto main should clear it; nothing else needs to change on your side.

[Automated review]

vjeux added 3 commits October 22, 2026 12:00
…ir font

The reset's form-element rule inherits `font` and `color`, but the
browser's stylesheet also sets `letter-spacing: normal` on button, input,
optgroup, select and textarea, and letter-spacing is not part of `font`,
so a control's text ignored the tracking around it. The rule now also
declares `letter-spacing: inherit`, as Tailwind Preflight does. No Astryx
component sets letter-spacing on a container of native controls.

The change alters only typography, so the changeset is a patch [feat]
(spec:AST-017 FR3, DEC-17) that names the old and new spacing and the
escape. No current record governs what reset.css declares.

The GitHub Pages landing serves a byte-identical copy of the file, which
its test requires to match, so the copy and its manifest hash move with it.
The opt-out sits in the reset layer, so it still yields to the styles a product or theme layers above the reset, and it now restores every old computed value checked in Chromium 149 (CodeBunny).
In Firefox 151 a content-sized select does not widen for letter-spacing:
under a 0.15em container an unstyled select stayed 92px wide while its
tracked label needed 103px, so "All statuses" showed as "All statu".
Chromium widens it. A select therefore keeps the browser's spacing: the
declaration moves to its own rule, `:where(button, input, textarea)`, and
the form rule is back to main's. optgroup has no browser rule of its own
(it inherits from its select), so the changeset's opt-out lists only the
three elements the rule changes; it matches the old reset in every case
checked in Chromium 149 and Firefox 151 (CodeBunny).

The GitHub Pages copy of reset.css and its manifest hash move with it.

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

Thanks — on this rebased head the change does what it describes: under the reset, button, input and textarea take their container's letter-spacing in Chromium and Firefox, select keeps the browser's spacing, CI is green, and the Changeset's opt-out brings back the old rendering exactly. It can't be approved yet only because no current spec decides what reset.css declares (AST-080 covers where its rules live and how it loads), so a maintainer needs to approve or reject inheriting letter-spacing for these three controls and provide or identify the spec that records that decision. Nothing else needs to change on your side.

[Automated review]

@kentonquatman

Copy link
Copy Markdown
Contributor

From a design standpoint, I'd expect these controls to match their intended text styles rather than inherit from wherever they're placed:

  • Input and textarea text should match body text, including its letter-spacing.
  • Button text should match the label text style.

TextInput and TextArea already take their family, size and line height from the body tokens (--font-family-body, --text-body-size, --text-body-leading), and Button takes --text-label-size / --text-label-leading. Letter-spacing is the gap because the type scale has no token for it. With letter-spacing: inherit, a field or button inside tracked text (say, an uppercase table header or toolbar) picks up that tracking, so the same TextInput can look different depending on where it sits. Core already guards against this kind of leak for layers: layerTextReset sets letterSpacing: 'normal' so surrounding formatting doesn't carry into menus and popovers.

Could you clarify why you want these controls to inherit letter-spacing? Is there a case where a control should follow its container's tracking instead of its own text style?

Alternative: make letter-spacing part of each text style instead of inheriting it.

  1. Add a letter-spacing token to the type scale next to size, weight and leading (e.g. --text-body-tracking, --text-label-tracking), defaulting to normal.
  2. Apply it wherever that style is applied: Text type="body", TextInput and TextArea (body), Button (label). TextInput and TextArea could pick up --text-body-weight at the same time, since their weight is also inherited today.
  3. Leave the reset as it is.

Input text then matches body text by definition, a theme that changes body tracking updates both in one place, and controls keep the same spacing wherever they're used.

@vjeux

vjeux commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, that's convincing. I'm closing this PR and leaving the reset as it is.

Why I wanted it: parity with Tailwind Preflight, which inherits letter-spacing on form controls so that a bare native control inside tracked text matches the text around it. I don't have a case where an Astryx field or button should follow its container's tracking. The reset's selectors also reach the elements TextInput, TextArea and Button render. Those set their own family, size and leading but no letter-spacing, so this change would have carried a tracked container's spacing into them, the leak layerTextReset guards against for layers. My description's "Astryx's components look the same" held only for Astryx's own layouts, not for a product's uppercase table header or toolbar.

The one control I found that should follow its container has no text style of its own: Link. It inherits family, size, weight and line height so it reads as part of the sentence, but as a <button> (no href) it gets the browser's letter-spacing: normal. With Link's declarations under the reset, inside 3px tracking, the anchor computes 3px and the button normal in Chromium 149 and Firefox 151. That fix would go in Link, next to its other inherits, not in the reset.

Your tracking-token alternative adds to the type scale, a theme contract, so it would start as a record for that contract's owner rather than in this PR.

@vjeux vjeux closed this Oct 23, 2026
@vjeux
vjeux deleted the reset-control-letter-spacing branch October 23, 2026 21:28

This branch was successfully deployed

1 active deployment
Preview — 19bafab0 Deployed Oct 22, 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.

2 participants