fix(button): canonical-reference audit (crash fix, a11y, shadcn v4)#47
Merged
Conversation
…lignment Deep adversarial audit of Button (the canonical component template ~40 components copy) across three lenses (shadcn/vision/API, a11y/mobile, Flutter-correctness). Fixes the findings so the reference is itself sound: CRITICAL - Crash fix (empirically reproduced): disabling a button WHILE pressed (async- submit flow) disposed the tap recognizer mid-gesture → onTapCancel→setState during build → assert crash. Clear callbacks are now always-wired; onTapDown guards internally. + regression test. - Touch target: visual sizes were 36-40px (below the mobile-first ≥44px rule, §4). Added MinTapTarget (a shared _utils RenderShiftedBox, Material's tap-target idiom) giving a ≥48px hit area decoupled from the visual size. + test. - Dynamic Type: fixed .h() heights silently CLIPPED labels at large OS text scales. Switched to minH + symmetric py so the button grows with scaled text (and py vertically centers). + growth test. DESIGN (user-approved) - Opaque hover: filled-variant hover now composites shadcn's /90 over the `background` token (opaque) instead of translucent alpha that bled cards/popovers. - Sizes aligned to current shadcn v4: sm h-8, md h-9, lg h-10, icon size-9. - Icon+text: new leading/trailing slots compose an FwRow(gap-2); icons render at 16px (shadcn [&_svg]:size-4) via IconTheme. + test + gallery/golden demo. - Kept the variant: enum API (consistent across the catalog); fixed the structure spec's stray Button.ghost(...) reference to Button(variant: ButtonVariant.ghost). POLISH - autofocus pass-through; palette via a record switch-expression (no `late`); doc-comments: semanticLabel override behavior, icon-button labeling requirement, the engine-fit rationale (don't convert to .tw state layers), known limitations. Goldens regenerated locally (Windows) + eyeball-verified; CI Linux re-baseline to follow (authoritative platform, §9). Full suite (14 tests) + analyze + format clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Linux renders pulled from the gallery job's failure artifact (Windows baselines diffed ~0.76% on edge AA). All 11 behavior + smoke tests already pass on Linux; only the 3 pixel goldens needed re-baselining (§9, CI Linux authoritative). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Deep adversarial audit of
Button— the canonical template ~40 components copy — across three Opus lenses (shadcn/vision/API, accessibility/mobile, Flutter-correctness). Fixes everything real so the reference is itself sound.Critical
onTapCancel→setStateduring build → assert crash. Clear callbacks are now always-wired;onTapDownguards internally. + regression test.MinTapTarget(a shared_utilsRenderShiftedBox— Material's tap-target idiom) for a ≥48px hit area decoupled from the visual. + test..h()heights silently clipped labels at large OS text scale. Switched tominH+ symmetricpyso the button grows with scaled text. + growth test.Design (your calls)
backgroundtoken (no surface bleed on cards/popovers).leading/trailingslots compose anFwRowgap-2; icons at 16px viaIconTheme. + gallery/golden demo.variant:enum API (consistent across the catalog); fixed the structure spec's strayButton.ghostreference.Polish
autofocuspass-through; record switch-expression palette (nolate); doc-comments forsemanticLabeloverride, icon-button labeling, engine-fit rationale, and known limitations. Deferredloading/tooltip(need Spinner/Tooltip components).Full suite (14 tests incl. crash + hit-target + scaling) + analyze + format clean locally. Goldens were regenerated on Windows + eyeball-verified; I'll re-baseline on CI Linux (authoritative, §9) once this run surfaces the renders.
🤖 Generated with Claude Code