Skip to content

Commit e9857f5

Browse files
authored
fix(Button): disabled state resolution in Button.Split context (#1134)
1 parent 6b66083 commit e9857f5

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix `Button` disabled state resolution in `Button.Split` context.
6+
7+
- Replace `??` chain with `||` so that `isLoading={false}` no longer blocks `splitContext.isDisabled` inheritance
8+
- Ensure `splitContext.isDisabled` always wins over child props (a disabled split button should disable all children)
9+
- Fix edge case where `isDisabled={false}` with `isLoading={true}` incorrectly resulted in a clickable loading button

src/components/actions/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export const Button = forwardRef(function Button(
400400
sizeProp ?? splitContext?.size ?? (type === 'link' ? 'inline' : 'medium');
401401

402402
const isDisabled =
403-
props.isDisabled ?? props.isLoading ?? splitContext?.isDisabled;
403+
splitContext?.isDisabled || props.isDisabled || props.isLoading;
404404
const isLoading = props.isLoading;
405405
const isSelected = props.isSelected;
406406

0 commit comments

Comments
 (0)