Conversation
085a68c to
bfd013e
Compare
bfd013e to
8359d37
Compare
There was a problem hiding this comment.
Pull request overview
Fixes ButtonGroup “all disabled” styling when buttons are wrapped in nested components (e.g., <Tooltip>), by making the disabled detection traverse into nested children.
Changes:
- Add a recursive
isChildDisabledhelper and use it to computestyles.disabledforButtonGroup. - Update the Storybook story to wrap disabled buttons in
<Tooltip>to demonstrate the nested-children case. - Update lockfile metadata (
yauzlrange for@ring-ui/screenshots) and remove an.ideaVCS settings block.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/button-group/button-group.tsx |
Implements recursive disabled detection to decide when to apply group disabled styling. |
src/button-group/button-group.stories.tsx |
Adjusts the story to include wrapped disabled buttons (Tooltip) to validate the fix visually. |
package-lock.json |
Updates the recorded semver range for yauzl in @ring-ui/screenshots metadata. |
.idea/vcs.xml |
Removes IDE GitHub shared project settings (branch protection patterns). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'props' in child && | ||
| (child as ReactElement<ButtonAttrs>).props.disabled, | ||
| ), | ||
| [styles.disabled]: childArray.length > 0 && childArray.every(isChildDisabled), |
There was a problem hiding this comment.
Because this.props.children is already ReactNode — exactly what isChildDisabled() needs — it can be passed there as is, without the conversion to an array
There was a problem hiding this comment.
This will short circuit on !('props' in child) if there's more than one child. So I will add proper handling for that case
Summary
styles.disabledcondition inButtonGroupto recursively traverse nested children (e.g. buttons wrapped in<Tooltip>) when determining whether all buttons are disabledisChildDisabledhelper that checksdisabledprop on direct button elements and recurses into wrapper elements' children<Tooltip>to demonstrate the fixFixes https://youtrack.jetbrains.com/issue/RG-2774
Test plan
ButtonGroupdoes not incorrectly get disabled styling🤖 Generated with Claude Code