Skip to content

fix(Button): hardening — swarm findings - #765

Merged
josephfarina merged 3 commits into
mainfrom
navi/hardening/button
Mar 24, 2026
Merged

fix(Button): hardening — swarm findings#765
josephfarina merged 3 commits into
mainfrom
navi/hardening/button

Conversation

@josephfarina

@josephfarina josephfarina commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Hardening fixes for XDSButton based on CC review.

Changes

  • type="button" default — prevents accidental form submission
  • prefers-reduced-motion on transitions
  • aria-disabled instead of native disabled when tooltip is present (keeps button focusable for tooltip keyboard access), with Enter/Space key suppression
  • backgroundImage: none on :hover and :active for aria-disabled state (prevents gradient flash)
  • Double-click guard via actionInFlightRef for async onClickAction
  • onClick fires before onClickAction so consumers can preventDefault() to cancel the action
  • Loading a11y: aria-hidden on content + spinner, live region announces Loading
  • CSS custom property escape hatches: --button-focus-offset, --button-icon-only-aspect

Screenshots

Story Screenshot
All Variants all-variants
Primary primary
Secondary secondary
Ghost ghost
Destructive destructive
Loading loading
Disabled disabled
Size Variants sizes
Icon Only icon-only
With End Slot end-slot

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 20, 2026
@josephfarina
josephfarina force-pushed the navi/hardening/button branch 2 times, most recently from ea3d4d3 to 0c586f6 Compare March 23, 2026 22:47
@josephfarina
josephfarina force-pushed the navi/hardening/button branch 5 times, most recently from bd94880 to dfa6178 Compare March 23, 2026 23:57
@josephfarina
josephfarina force-pushed the navi/hardening/button branch from dfa6178 to 537b36e Compare March 24, 2026 00:01
@josephfarina
josephfarina marked this pull request as ready for review March 24, 2026 00:01
@josephfarina
josephfarina requested a review from cixzhang as a code owner March 24, 2026 00:01
@github-actions

github-actions Bot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Button · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 394B N/A
Lines of Code N/A 372 -
Complexity N/A Very High (39) -
Layout · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.1KB N/A
Lines of Code N/A 902 -
Complexity N/A Very High (66) -
MoreMenu · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 686B N/A
Lines of Code N/A 375 -
Complexity N/A Very High (49) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 11.0KB 17.6KB 2.7KB

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

XDSLayout - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

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

@josephfarina
josephfarina merged commit 48af565 into main Mar 24, 2026
13 checks passed
@cixzhang
cixzhang deleted the navi/hardening/button branch April 9, 2026 14:33
cixzhang pushed a commit that referenced this pull request Apr 26, 2026
* fix(Button): hardening — swarm findings

* fix(Button): swarm fixes — verified findings

* review: restore name/value/form props removed by hardening (no breaking changes)

---------

Co-authored-by: Joey Farina <joeyfarina@fb.com>
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
* fix(Button): hardening — swarm findings

* fix(Button): swarm fixes — verified findings

* review: restore name/value/form props removed by hardening (no breaking changes)

---------

Co-authored-by: Joey Farina <joeyfarina@fb.com>
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
* fix(Button): hardening — swarm findings

* fix(Button): swarm fixes — verified findings

* review: restore name/value/form props removed by hardening (no breaking changes)

---------

Co-authored-by: Joey Farina <joeyfarina@fb.com>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant