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
[Input][base] Fix calling slotProps event handlers #37463
Conversation
Netlify deploy previewhttps://deploy-preview-37463--material-ui.netlify.app/ Bundle size report |
getSlotProps: (otherHandlers: EventHandlers) => { | ||
return getInputProps({ | ||
...otherHandlers, | ||
...propsToForward, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherHandlers
will have eventHandlers
passed in slotProps
where as propsToForward
will have eventHandlers
passed to Input
component.
According to previous code, eventHandlers
in propsToForward
will always override eventHandlers
passed in slotProps
, this PR adds a small caveat to the functionality, where eventHandlers
in propsToForward
will only override if there is valid function available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
closes: #37134
before: https://codesandbox.io/s/broken-cookies-k6px3x?file=/demo.tsx:1459-1539
after: https://codesandbox.io/s/elated-bessie-7k0dkm