chore(action-button): implement accessibility features#6348
Conversation
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
1df39ae to
2d0ee29
Compare
2d0ee29 to
66c5032
Compare
…ponent (#6327) * feat(action-button): adds migration plan for the S2 action button component * chore(action-button): address feedback * chore(action-button): address feedback
* chore(action-button): adds structure for s2 migration * chore: clean up base class and export types * chore(action-button): update migration plan * chore(action-button): address feedback
66c5032 to
92cd13c
Compare
92cd13c to
5e65e8d
Compare
Description
Implements Phases 2–4 of the 1st-gen → 2nd-gen
swc-action-buttonmigration:swc-action-buttoncomponent in both2nd-gen/packages/core(types) and2nd-gen/packages/swc(component, stories, tests).ActionButtonextendingButtonBase, including thexs–xlsize scale,quiet,static-color, and the no-default-attribute size behavior via a_size=nullsentinel.aria-haspopup/aria-expanded(forwarded to the inner<button>, then stripped from the host), a pending-icon element for Phase 5 CSS targeting, and aligned JSDoc across all public members.Also adds
@deprecatedJSDoc andwindow.__swc.warn()runtime warnings to the 1st-gensp-action-buttonforemphasized,holdAffordance,selected, andtoggles— signaling the migration path to consumers.Motivation and context
swc-action-buttonis a high-frequency component used in toolbars, action groups, and icon-first chrome. The 2nd-gen version removes toggle semantics (toggles,selected,aria-pressed), the link API (href), and the consumer-controlledroleoverride — all of which were identified in the migration analysis as footguns or anti-patterns. Toggle / selection UX moves to the forthcomingswc-toggle-button/swc-toggle-button-group.Related issue(s)
Screenshots (if appropriate)
N/A — no visual output yet (CSS is a stub; Phase 5 adds styling).
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
1st-gen deprecation warnings fire in dev mode
sp-action-buttonemphasized,holdAffordance,selected, ortoggleson the elementwindow.__swc.warn()deprecation warning appears for each2nd-gen size attribute not reflected by default
swc-action-buttonsizeattribute on the host until one is explicitly set;button.sizeJS property returns'm'ARIA passthrough:
aria-haspopup/aria-expandedforwarded and strippedaria-haspopup="true"andaria-expanded="false"on a<swc-action-button>aria-haspopupnoraria-expandedshadowRoot.querySelector('button')in the console<button>carries botharia-haspopup="true"andaria-expanded="false"Device review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps.
Keyboard (required — document steps below)
swc-action-button<button>, not the host;shadowRoot.activeElementreturns the inner<button>EnterandSpacependingattribute; tab back to the buttonEnter/Spacedo not fire clickdisabledattribute; tab through the pageScreen reader (required — document steps below)
swc-action-buttonwith VoiceOver (macOS) or NVDA (Windows)<swc-action-button>Edit</swc-action-button>accessible-label="Format"aria-haspopup="true"andaria-expanded="false"on the buttonpendingattribute