Skip to content

fix(Button): at the default text size a labelled button renders exactly as before - #10678

Merged
cixzhang merged 5 commits into
mainfrom
lane4/button-default-size-exact
Nov 8, 2026
Merged

cixzhang merged 5 commits into
mainfrom
lane4/button-default-size-exact

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

At the default text size, every labelled Button now renders exactly as it did before #10588, including Buttons whose caller sets a shorter height. #10588 made a labelled Button's size a minimum height and dropped its block padding. A caller's shorter height, like the Lightbox caption's more/less toggle, was then held at the element size and moved 4 px. Under a larger text size, labelled Buttons still grow with their label, as #10416's gate needs.

What changes

  • Button.tsx:
    • A labelled size is a real height again: height: max(var(--size-element-*), 1lh). The base paddingBlock (--spacing-2) is restored.
    • At the default text size, one label line (1lh, from Button's own label line height) is shorter than the element size, so the height is exactly the element size. A caller's height replaces the whole declaration, as before fix(Button): a labelled button grows with its label #10588.
    • Under a larger text size the line is taller, so the button grows and its label stays inside.
    • Icon-only Buttons keep their fixed square, unchanged.
  • The DateInput and DateTimeInput bottom-sheet Reset minBlockSize defaults go back to their pre-fix(Button): a labelled button grows with its label #10588 values, since a real height makes them unnecessary.
  • fix(Button): a labelled button grows with its label #10588's Butter (inline padding only), CLI bundle and table-filter changes stay. With a real height they change nothing at the default text size (the pixel check below covers Butter).
  • component:Button FR4: "A labelled button's height is that element size, or one line of its label when the line is taller… at the default text size the height is the element size, and a caller's height replaces it."
  • The button-grows-with-text changeset (still unreleased) describes the final behavior.

Tests

  • Red-first, Button.test.tsx "default size geometry": a caller's height holds with no minimum, and the block padding is restored. Both fail on main.
  • ButtonTextSize.interaction.browser.spec.ts: at the default text size, each theme's labelled sm, md and lg Buttons (neutral and Butter) match their element-size tokens exactly. Larger text still grows them.
  • AlertDialog and Toast unit tests read the restored height.

Evidence (real Chrome, default text size)

Writing rubric results

  • R1 narration: none; FR4 is present tense.
  • R2 research in the record: none.
  • R3 evidence naming a change: none.
  • R4 rejected alternatives: none.
  • R5 pull request or issue references: none in the record.
  • R6 open questions: none.

…ly as before

#10588 made a labelled Button's size a minimum height and dropped its
block padding, so a caller's shorter height (Lightbox's caption toggle)
was held at the element size. The height is again a real height:
max(element size, 1lh), with the block padding restored. At the default
text size one label line is shorter than the element size, so the height
is the element size and a caller's height replaces it, as before. Under
a larger text size the line is taller and the button grows. The date
sheet Reset defaults, Butter's padding removal and the table-filter
minHeight that #10588 needed are reverted, with their changesets.
@vercel

vercel Bot commented Nov 8, 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 8, 2026 5:39pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 8, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 8, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026
@astracat-bot

astracat-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 8, 2026, 5:51 PM UTC

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1ed54da

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
SideNavHeading 74.4 kB (+21 B) · 11.2 kB CSS (+53 B) — — · — · —
TopNavMegaMenu 68.6 kB (+20 B) · 11.8 kB CSS (+53 B) — — · — · —
SideNavItem 69.3 kB (+18 B) · 11.1 kB CSS (+52 B) — — · — · —
72 more components
Component Size LoC Visual · A11y · RTL
TabMenu 70.7 kB (+25 B) · 11.1 kB CSS (+44 B) — — · — · —
TopNavMenu 73.5 kB (−2 B) · 11.2 kB CSS (+55 B) — — · — · —
Calendar 70.2 kB (+11 B) · 10.5 kB CSS (+41 B) — — · — · —
Pagination 108.4 kB (−4 B) · 17.7 kB CSS (+51 B) — — · — · —
Typeahead 78.5 kB (−3 B) · 12.4 kB CSS (+42 B) — — · — · —
Tokenizer 90.2 kB (−4 B) · 18.6 kB CSS (+42 B) — — · — · —
DateRangeInput 91.1 kB (−4 B) · 12.4 kB CSS (+36 B) — — · — · —
PowerSearch 282.7 kB (−14 B) · 23.8 kB CSS (+44 B) — — · — · —
Selector 98.3 kB (−9 B) · 17.3 kB CSS (+37 B) — — · — · —
TableSelectionToolbar 69.4 kB (−3 B) · 13.2 kB CSS (+31 B) — — · — · —
ChatComposerInput 74.5 kB (+3 B) · 11.2 kB CSS (+19 B) — — · — · —
ChatComposerTokenElement 74.5 kB (+2 B) · 11.2 kB CSS (+19 B) — — · — · —
Carousel 68.6 kB (−1 B) · 10.9 kB CSS (+21 B) — — · — · —
ChatComposer 76.8 kB (+1 B) · 12.0 kB CSS (+19 B) — — · — · —
ChatDictationButton 59.7 kB (0) · 10.0 kB CSS (+20 B) — — · — · —
DateInput · Storybook 183.0 kB (−21 B) · 16.9 kB CSS (+41 B) 5,698 (−3) — · — · —
TopNavHeading 73.8 kB (−3 B) · 11.0 kB CSS (+23 B) — — · — · —
DialogHeader 62.0 kB (+1 B) · 11.5 kB CSS (+18 B) — — · — · —
Popover 87.9 kB (−1 B) · 14.1 kB CSS (+20 B) — — · — · —
ChatSendButton 59.6 kB (+1 B) · 9.9 kB CSS (+17 B) — — · — · —
Stepper 60.8 kB (−2 B) · 10.1 kB CSS (+20 B) — — · — · —
Timestamp 32.3 kB (0) · 10.2 kB CSS (+18 B) — — · — · —
Button · Storybook 59.2 kB (−1 B) · 9.9 kB CSS (+17 B) 690 (+1) — · — · —
MobileNavToggle 59.5 kB (−1 B) · 9.9 kB CSS (+17 B) — — · — · —
Thumbnail 63.5 kB (−2 B) · 11.5 kB CSS (+18 B) — — · — · —
AlertDialog · Storybook 104.2 kB (−5 B) · 14.4 kB CSS (+20 B) 211 (0) — · — · —
ChatLayoutScrollButton 59.7 kB (−2 B) · 10.1 kB CSS (+17 B) — — · — · —
ChatLayout 79.4 kB (−1 B) · 10.5 kB CSS (+15 B) — — · — · —
DrawerHeader 62.2 kB (−3 B) · 12.9 kB CSS (+17 B) — — · — · —
IconButton 59.2 kB (−3 B) · 9.9 kB CSS (+17 B) — — · — · —
Lightbox 119.4 kB (−2 B) · 10.5 kB CSS (+16 B) — — · — · —
Toast · Storybook 97.0 kB (−1 B) · 10.2 kB CSS (+15 B) 1,644 (0) — · — · —
ToggleButton 85.7 kB (−6 B) · 10.0 kB CSS (+20 B) — — · — · —
Banner 61.2 kB (−2 B) · 10.5 kB CSS (+15 B) — — · — · —
DateTimeInput · Storybook 204.8 kB (−20 B) · 18.6 kB CSS (+33 B) 3,613 (0) — · — · —
Markdown 179.5 kB (+1 B) · 20.3 kB CSS (+12 B) — — · — · —
SideNavCollapseButton 60.0 kB (−4 B) · 10.0 kB CSS (+16 B) — — · — · —
MobileNav 69.5 kB (−1 B) · 10.6 kB CSS (+11 B) — — · — · —
AppShell 89.6 kB (−1 B) · 13.5 kB CSS (+10 B) — — · — · —
BaseTypeahead 70.0 kB (−1 B) · 10.9 kB CSS (+10 B) — — · — · —
CodeBlock 73.9 kB (+1 B) · 11.2 kB CSS (+8 B) — — · — · —
TableCell 107.5 kB (−2 B) · 17.6 kB CSS (+11 B) — — · — · —
ContextMenu 106.3 kB (−2 B) · 17.2 kB CSS (+10 B) — — · — · —
SideNav 111.0 kB (−3 B) · 11.3 kB CSS (+11 B) — — · — · —
TopNav 71.2 kB (−2 B) · 10.9 kB CSS (+10 B) — — · — · —
Table 116.4 kB (−1 B) · 17.9 kB CSS (+8 B) — — · — · —
TableHeaderCell 107.1 kB (−2 B) · 17.4 kB CSS (+9 B) — — · — · —
TimeInput 158.6 kB (−5 B) · 15.9 kB CSS (+12 B) — — · — · —
MultiSelector 93.6 kB (−7 B) · 16.8 kB CSS (+13 B) — — · — · —
BreadcrumbItem 83.4 kB (−4 B) · 12.1 kB CSS (+9 B) — — · — · —
DropdownMenu 95.7 kB (−5 B) · 17.3 kB CSS (+9 B) — — · — · —
TextInput 66.6 kB (−5 B) · 11.1 kB CSS (+8 B) — — · — · —
MoreMenu 96.0 kB (−8 B) · 17.3 kB CSS (+9 B) — — · — · —
lab/CommentThread 332.7 kB (+1 B) · 2.4 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 102.4 kB (−1 B) · 773 B CSS (0) — — · — · —
lab/ChatReactionBar 103.6 kB (−1 B) · 1.1 kB CSS (0) — — · — · —
lab/DialogHeroHeader 81.8 kB (−1 B) · 372 B CSS (0) — — · — · —
lab/Schedule 104.6 kB (−1 B) · 3.9 kB CSS (0) — — · — · —
NumberInput 70.6 kB (−9 B) · 11.4 kB CSS (+7 B) — — · — · —
lab/TourStep 94.2 kB (−2 B) · 590 B CSS (0) — — · — · —
lab/DiffViewer 85.6 kB (−3 B) · 2.1 kB CSS (0) — — · — · —
lab/CommentComposer 147.3 kB (−5 B) · 1.9 kB CSS (0) — — · — · —
lab/Comments 339.4 kB (−5 B) · 2.5 kB CSS (0) — — · — · —
lab/EmojiPicker 85.2 kB (−6 B) · 751 B CSS (0) — — · — · —
lab/TransferList 106.5 kB (−6 B) · 1.7 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 276.1 kB (−7 B) · 454 B CSS (0) — — · — · —
ComplexSelector 69.8 kB (−18 B) · 11.8 kB CSS (+10 B) — — · — · —
FileInput 68.0 kB (−15 B) · 10.9 kB CSS (+7 B) — — · — · —
lab/ListInput 100.5 kB (−9 B) · 1.6 kB CSS (0) — — · — · —
lab/TransferListSelector 113.1 kB (−9 B) · 1.9 kB CSS (0) — — · — · —
richtext/RichTextEditor 295.6 kB (−12 B) · 2.6 kB CSS (0) — — · — · —
richtext/RichTextView 274.9 kB (−18 B) · 2.3 kB CSS (0) — — · — · —

Package size:

  • @astryxdesign/cli 3.52 MB packed (−24 B); no new dependencies
  • @astryxdesign/core 7.01 MB packed (+139 B); no new dependencies
  • @astryxdesign/theme-butter 45.8 kB packed (−76 B); no new dependencies

API changes: none in this pull request

Committed API report behind this build: cli 29 rows, core 35 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.

Wide change (shared styles: packages/themes/butter/src/butterTheme.ts): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 29a6633

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026

@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: three test fixes, after which the change is ready for another look. The reworded component:Button FR4 is owner-approved for this head, and the Button change follows it.

  • AlertDialog.test.tsx:294 fails because StyleX emits max(var(--size-element-md),1lh) without the space, so the expectation should use that string.
  • ToastViewport.test.tsx:208-210 fails for the same reason and should expect max(var(--size-element-lg),1lh).
  • Button.test.tsx:856 passes even with no block padding, because both padding reads return '' on main; asserting expect(computed.paddingBlock).toBe('var(--spacing-2)') makes it fail without the padding.

In a real-browser run, default-size Buttons render identically to main in all eight themes, a caller's shorter height applies again, and larger text still grows the button.

[Automated review]

Comment thread packages/core/src/Button/Button.tsx Resolved
… height leaves harmless

AlertDialog and Toast read the restored labelled Button height.
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 7d59164

@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 reworded component:Button FR4 is owner-approved for this head and the Button change follows it, and the AlertDialog and Toast expectations now pass, but three fixes remain.

  • Miss: component:Button AR6 still says every Button is at least 28 CSS pixels tall, while the reworded FR4 lets a caller's height replace the size (a 20 px caller height renders a 20 px Button), so AR6 should leave a caller's height to that caller, as it already does for width.
  • .changeset/butter-button-keeps-height.md and .changeset/table-filter-header-actions-keep-size.md still tell consumers that a Button's size is a minimum height, which this pull request undoes, so delete or reword them along with the matching comment at butterTheme.ts:397-398 in both Butter copies.
  • Button.test.tsx:856 passes even without block padding because jsdom returns '' for both reads, so assert expect(computed.paddingBlock).toBe('var(--spacing-2)') instead.

The branch also conflicts with main in the Button record's verification table; after the rebase, an engineering owner records the spec decision again by commenting /approve-spec <full head SHA> on the new head. Non-blocking: the FR4 verification row says "each theme" while the browser spec covers Neutral and Butter, and the new Button.tsx comment restates the code.

[Automated review]

@cixzhang
cixzhang marked this pull request as draft November 8, 2026 17:01
@cixzhang
cixzhang marked this pull request as ready for review November 8, 2026 17:02
…-default-size-exact

# Conflicts:
#	docs/specs/components/Button/Button.spec.md
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 4d59677

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026

@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 reworded component:Button FR4 is owner-approved for this head and the Button change follows it, but four fixes remain.

  • Miss: component:Button AR6 still says every Button is at least 28 CSS pixels tall, while the reworded FR4 lets a caller's height replace the size (a 20 px caller height renders a 20 px Button), so AR6 should leave a caller's height to that caller, as it already does for width.
  • .changeset/butter-button-keeps-height.md and .changeset/table-filter-header-actions-keep-size.md still tell consumers that a Button's size is a minimum height, which this pull request undoes, so delete or reword them along with the matching comment at butterTheme.ts:397-398 in both Butter copies.
  • Button.test.tsx:856 passes even without block padding because jsdom returns '' for both reads, so assert expect(computed.paddingBlock).toBe('var(--spacing-2)') instead.
  • Found by CI: the lint job fails because Button.test.tsx:842-844 is not Prettier-formatted, which pnpm exec prettier --write packages/core/src/Button/Button.test.tsx fixes by putting the render(...) call on one line.

Any new commit needs a fresh spec decision: an engineering owner, the author included, comments /approve-spec <full head SHA> on the new head. Non-blocking: the FR4 verification row says "each theme" while the browser spec covers Neutral and Butter, and the new Button.tsx comment restates the code.

[Automated review]

…angesets match

A caller's height now replaces a labelled Button's size, so AR6's 28 px
floor names that exception. The Butter and table-filter changesets and
the Butter comment no longer say a Button's size is a minimum height.
The unit test asserts the restored block padding itself.
@cixzhang
cixzhang marked this pull request as draft November 8, 2026 17:30
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 1ed54da

@cixzhang
cixzhang marked this pull request as ready for review November 8, 2026 17:34

@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 reworded component:Button FR4 and AR6 are owner-approved for this head, and the Button change, its tests and the changesets follow them; CI is green on this head.

The four fixes from the previous review are all in: AR6 names the caller-height exception, the Butter and table-filter changesets no longer describe a minimum height, the block-padding test now fails without the padding, and Button.test.tsx is formatted.

One optional suggestion: the size-style comment in Button.tsx gives the label line's length as the reason a caller's height replaces the declaration, while the real reason is that it is a height rather than a min-height; see the inline note for a shorter rewrite.

[Automated review]

Comment on lines +273 to +275
// At the default text size one label line is shorter than the element size,
// so a caller's height still replaces this one. A larger text size makes the
// line taller, and the button grows with its label.

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.

Non-blocking (INV29): a caller's height replaces this declaration because it is a height, not a min-height, and caller xstyle merges last; the label line's length only decides which value wins. A rewrite that keeps only the reasons:

// A height, not a minimum, so a caller's height still replaces it.
// `1lh` grows the button when a larger text size makes the label line
// taller than the element size.

@cixzhang
cixzhang merged commit 5444422 into main Nov 8, 2026
128 checks passed
@github-actions
github-actions Bot deleted the lane4/button-default-size-exact branch November 9, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 1ed54daf Deployed Nov 8, 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