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

[material-ui][SwitchBase] Fix spreading of handlers in getSlotProps #45197

Merged
merged 8 commits into from
Feb 4, 2025

Conversation

sai6855
Copy link
Contributor

@sai6855 sai6855 commented Feb 3, 2025

handlers was spread in root slot but i think it got missed in input slot

root slot:

getSlotProps: (handlers) => ({
...handlers,
onFocus: (event) => {
handlers.onFocus?.(event);
handleFocus(event);

input slot:

getSlotProps: (handlers) => ({
onChange: (event) => {
handlers.onChange?.(event);

@sai6855 sai6855 added bug 🐛 Something doesn't work component: switch This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Feb 3, 2025
@sai6855 sai6855 requested a review from siriwatknp February 3, 2025 18:39
@mui-bot
Copy link

mui-bot commented Feb 3, 2025

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against fb520f6

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

Would be nice to add a test for this.

@sai6855 sai6855 enabled auto-merge (squash) February 4, 2025 15:04
@sai6855 sai6855 merged commit 9074d47 into mui:master Feb 4, 2025
19 checks passed
});

expect(rootOnClick.callCount).to.equal(1);
expect(inputOnClick.callCount).to.equal(1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is failing in master branch as onClick handler wasn't spread in getSlotProps and it's passing in this PR

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: switch This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants