chore(button-group): 2nd-gen migration plan#6333
Conversation
- document 1st-gen API surface (vertical, size, slot, CSS tokens) - define 2nd-gen API decisions aligned with React Spectrum S2 and Figma - identify breaking change: vertical boolean replaced by orientation property - capture accessibility requirements from migration analysis (role=group, aria-orientation, no roving tabindex) - include Figma S2 Desktop reference screenshot - flag open questions for XL size support and overflow behavior scope - register migration plan in components README navigation Epic: SWC-2071 Ref: SWC-2073 Co-authored-by: Cursor <cursoragent@cursor.com>
|
- binary assets should not be committed to the repository Co-authored-by: Cursor <cursoragent@cursor.com>
📚 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 |
| - **Add `role="group"` and `aria-orientation`** on the host for WCAG compliance (1st-gen is missing this). | ||
| - **Add `align` property** for button alignment (start/center/end); matches React S2. | ||
| - **Propagate disabled state** from group to children via an optional `disabled` attribute. | ||
| - **Overflow behavior (auto-switch to vertical)** is documented in React S2 but is not in the Figma design spec; flagged as an open question and out of scope for MVP unless decided otherwise. |
There was a problem hiding this comment.
I was hoping this could be achieved with flex layout and maybe some kind of container query, but it seems it would need ResizeObserver for the most dependable switch, unless regular flex wrapping would be acceptable vs. the all-at-once orientation switch. Since we aren't controlling arrow key navigation, regular flex wrapping may be an acceptable starting point?
| Button group is a simple layout and semantics wrapper for related button actions. The 1st-gen implementation is minimal (flexbox container with size propagation), making the migration straightforward. The core changes are: | ||
|
|
||
| - **Rename `vertical` boolean to `orientation` property** (aligns with React Spectrum S2 and Figma); this is the only consumer-facing breaking change. | ||
| - **Add `role="group"` and `aria-orientation`** on the host for WCAG compliance (1st-gen is missing this). |
There was a problem hiding this comment.
Since we are not coupling focus group type of behaviors, I don't think aria-orientation makes sense to include since it is intended to convey direction of arrow key navigation, which the component will not be enforcing. I know it was in the a11y plan, but I think it was an oversight after that plan was updated to remove inclusion of focus group.
|
|
||
| ### Most blocking open questions | ||
|
|
||
| - Q1 in [Design](#design): Should XL size be supported in 2nd-gen? Figma shows it but React S2 limits to S/M/L. |
There was a problem hiding this comment.
This is incorrect, React also has XL. Also is stands to reason it should support any sizes Button supports since the "group" doesn't resize, it just passes off the size to each Button.
|
|
||
| | # | Item | Blocking? | Status | Owner | | ||
| | --- | ---- | --------- | ------ | ----- | | ||
| | **Q1** | Should `size="xl"` be supported in 2nd-gen? Figma S2 Desktop shows XL but React S2 limits to S/M/L. The spectrum-css `spectrum-two` branch only defines spacing for default and sizeS; no dedicated XL token. **Recommendation:** Align with React S2 (S/M/L only) and treat XL as additive/deferred. | Yes — affects type definition and test matrix | Open | Design + implementation | |
There was a problem hiding this comment.
As noted earlier, React does have XL. Size S uses an 8px gap and the rest use a 12px gap, so the same token as used for M-L can also be used for XL.
- Remove aria-orientation: not valid on role="group" since button-group does not implement focus group / arrow-key navigation - Resolve Q1: XL is supported by React S2 and uses same 12px gap token as M/L; mark as confirmed in type definition - Update Q2: incorporate feedback that regular flex wrapping may be an acceptable starting point; mark as deferred from MVP Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
button-group(1st-gen → 2nd-gen), documenting the full API surface, breaking changes, 2nd-gen API decisions, architecture, and testing planMotivation
This is the planning ticket (SWC-2073) for the button-group 2nd-gen migration epic (SWC-2071). The plan must be reviewed and approved before any implementation work begins.
What this covers
1st-gen API documented
vertical(boolean),size(s/m/l/xl via SizedMixin)sp-buttonchildren2nd-gen API decisions
vertical→orientationproperty ("horizontal" | "vertical") aligned with React Spectrum S2role="group"andaria-orientation(missing in 1st-gen)disabledattribute for group-level disable propagation"m"as default (1st-gen had no default)Architecture
Open questions requiring team input
alignproperty be MVP or additive?Related issues
References
Test plan