dogfooding fixes: Button size uses min-height so theme padding overrides compose#3472
Open
josephfarina wants to merge 1 commit into
Open
dogfooding fixes: Button size uses min-height so theme padding overrides compose#3472josephfarina wants to merge 1 commit into
josephfarina wants to merge 1 commit into
Conversation
Button size styles set a fixed `height` per size, which under `box-sizing: border-box` absorbed any theme `paddingBlock` override — so theming a taller button silently did nothing. Replace the fixed `height` with `min-height` and move a per-size `paddingBlock` (sm/md/lg) into the size styles (removing the base `paddingBlock`). Default heights (28/32/36) and icon-only square sizing are unchanged, but a padding override now grows the button. Fixes #3379
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
Increasing a Button's height via a theme
paddingBlockoverride silently did nothing. Button size styles hard-coded a fixedheightper size, and underbox-sizing: border-boxthat fixed height absorbed any padding added in the theme — no error, no visual change. Fixes #3379.Root cause
The base style sets
paddingBlock: 8pxwithline-height ≈ 20px, so the natural content height is 36px. Each size then pinned a fixedheight(sm 28 / md 32 / lg 36), clamping the content below natural. A theme override like:emits
.astryx-button.lg { padding-block: 20px }— but the button stays 36px tall because the fixedheightis still in effect and border-box makes the extra padding eat into those 36px. Result: no visible change.The trap, measured (real Chrome render)
Fixed height: default sm/md/lg render 28/32/36. A naive
height→min-heightswap is not safe — it makes every sm/md button jump to the 36px natural content height (a system-wide regression), and it collapses icon-only buttons (which useaspect-ratio: 1/1with zero padding, soheightdefines the square):The fix
Replace the fixed
heightwithmin-heightper size and move a per-sizepadding-block(sm--spacing-1/ md--spacing-1-5/ lg--spacing-2) into the size styles, removing the basepadding-block. This keeps default heights pixel-identical, preserves icon-only squares, and lets a theme padding override grow the button.Verified in real Chrome — every check passes: default label heights stay exactly 28/32/36, icon-only stays square (28×28 / 32×32 / 36×36), and a
paddingBlockoverride grows the button (lg + pad20 → 60px):Why not just
height: autoon override (the issue's workaround)?That requires every theme author to know the non-obvious
height: 'auto'trick. Makingmin-heightthe default means the natural theming lever (paddingBlock) composes as expected, with no workaround.Verification
scripts/build-css.test.mjs): new regression test asserts the Button size classes emitmin-height:var(--size-element-*)and per-sizepadding-block, and that the size rule carryingmin-heightdoes not also pin a fixedheight. (This is the source-of-truth layer — StyleX atomic classes aren't visible to jsdom.)paddingBlockoverride.padding-block:0+aspect-ratioconfirmed intact in the compiled CSS (icon-only style is applied after the size style, so it still wins).