Skip to content

fix: ButtonGroup drops injected aria-checked/role via overrides.BaseButton - #5412

Merged
dyesin merged 2 commits into
uber:mainfrom
zigzagdev:fix/button-group-overrides-merge
Sep 25, 2026
Merged

dyesin merged 2 commits into
uber:mainfrom
zigzagdev:fix/button-group-overrides-merge

Conversation

@zigzagdev

Copy link
Copy Markdown
Contributor

Fixes #1, Fixes #2

Description

ButtonGroup injects aria-checked/role onto each child via overrides.BaseButton, then spread ...child.props.overrides after it.
If a child button also set overrides.BaseButton (even just for an unrelated prop like style), the shallow spread replaced the whole BaseButton override object and silently dropped the injected aria-checked/role, breaking radio/checkbox a11y semantics.

Now, the child's overrides.BaseButton is merged on top of the injected one instead of replacing it wholesale, so aria checked/role survive unless the child explicitly overrides them.

Scope

Patch: Bug Fix

…seButton

ButtonGroup spread `...child.props.overrides` after its own injected
`overrides.BaseButton`, so a child that also set `overrides.BaseButton`
(even for unrelated props like `style`) replaced the whole object and
silently dropped the `aria-checked`/`role` ButtonGroup relies on for
radio/checkbox semantics. Merge the child's BaseButton override on top
of the injected one instead of replacing it wholesale.
Regression test for radio-mode ButtonGroup children that also pass
overrides.BaseButton (e.g. for style) — aria-checked and role must
still be set correctly.
@dyesin
dyesin merged commit 344c5d2 into uber:main Sep 25, 2026
3 checks passed
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.

2 participants