Skip to content

fix(button): canonical-reference audit (crash fix, a11y, shadcn v4)#47

Merged
SiphoChris merged 2 commits into
mainfrom
fix/button-canonical-audit
Jun 15, 2026
Merged

fix(button): canonical-reference audit (crash fix, a11y, shadcn v4)#47
SiphoChris merged 2 commits into
mainfrom
fix/button-canonical-audit

Conversation

@SiphoChris

Copy link
Copy Markdown
Owner

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

  • Crash fix (empirically reproduced): disabling a button while pressed (the async-submit flow) disposed the tap recognizer mid-gesture → onTapCancelsetState 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) for a ≥48px hit area decoupled from the visual. + test.
  • Dynamic Type: fixed .h() heights silently clipped labels at large OS text scale. Switched to minH + symmetric py so the button grows with scaled text. + growth test.

Design (your calls)

  • Opaque hover — composites shadcn's /90 over the background token (no surface bleed on cards/popovers).
  • Sizes → 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 at 16px via IconTheme. + gallery/golden demo.
  • Kept variant: enum API (consistent across the catalog); fixed the structure spec's stray Button.ghost reference.

Polish

autofocus pass-through; record switch-expression palette (no late); doc-comments for semanticLabel override, icon-button labeling, engine-fit rationale, and known limitations. Deferred loading/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

…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>
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flutterbits Ready Ready Preview, Comment Jun 15, 2026 6:25am

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>
@SiphoChris SiphoChris merged commit 2396523 into main Jun 15, 2026
8 checks passed
@SiphoChris SiphoChris deleted the fix/button-canonical-audit branch June 15, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant