Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[joy-ui][Button] Fix disabled prop priority when inside button group #41000

Merged
merged 4 commits into from Feb 12, 2024

Conversation

Smileek
Copy link
Contributor

@Smileek Smileek commented Feb 8, 2024

Fixed a bug in the Button component:

image

ButtonGroup's disabled prop wasn't overridden, because the first part of (inProps.disabled || inProps.loading) ?? (buttonGroup.disabled || disabledProp || loading); resulted in (false || undefined) which is undefined.

The correct order is (inProps.loading || inProps.disabled), because if it's loading, we should always disable a button. If it's not (whether false or undefined), we should rely on disabled prop which could be true, false or undefined and make the whole construction work properly.

@mui-bot
Copy link

mui-bot commented Feb 8, 2024

Netlify deploy preview

https://deploy-preview-41000--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 4bf7f03

@Smileek Smileek marked this pull request as ready for review February 8, 2024 10:27
@danilo-leal danilo-leal changed the title [joy-ui][Button] fix Button disabled prop priority [joy-ui][Button] Fix disabled prop priority Feb 8, 2024
@danilo-leal danilo-leal added component: button This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy labels Feb 8, 2024
@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work component: ButtonGroup The React component. labels Feb 8, 2024
@ZeeshanTamboli ZeeshanTamboli changed the title [joy-ui][Button] Fix disabled prop priority [joy-ui][Button] Fix disabled prop priority when inside button grup Feb 8, 2024
@ZeeshanTamboli ZeeshanTamboli changed the title [joy-ui][Button] Fix disabled prop priority when inside button grup [joy-ui][Button] Fix disabled prop priority when inside button group Feb 8, 2024
@ZeeshanTamboli
Copy link
Member

Also, it's a regression from #38673.

@ZeeshanTamboli ZeeshanTamboli added the regression A bug, but worse label Feb 9, 2024
@Smileek Smileek force-pushed the smileek/fix-button-disabled-prop branch from f228a0f to e9d460d Compare February 9, 2024 16:34
@ZeeshanTamboli ZeeshanTamboli removed the component: ButtonGroup The React component. label Feb 12, 2024
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Smileek Thanks for the fix!

@ZeeshanTamboli ZeeshanTamboli merged commit 7c0aa2c into mui:master Feb 12, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: button This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants