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] Add merging function to mergeSlotProps utility #45543

Merged
merged 15 commits into from
Mar 18, 2025

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Mar 11, 2025

closes #45503

Docs: https://deploy-preview-45543--material-ui.netlify.app/material-ui/guides/composition/#forwarding-slot-props

Issue

Currently, mergeSlotProps does not compose event handlers. So event handlers passed by the slotProps.* will override the default event handlers.

Fix

Iterate the default props and check if the key is an event handler (follow the same logic as in Base UI), then compose it with the one from the slotProps.*


@siriwatknp siriwatknp added the package: material-ui Specific to @mui/material label Mar 11, 2025
@mui-bot
Copy link

mui-bot commented Mar 11, 2025

Netlify deploy preview

@material-ui/core: parsed: +Infinity% , gzip: +Infinity%
@mui/joy: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Autocomplete: parsed: +Infinity% , gzip: +Infinity%
Autocomplete: parsed: +Infinity% , gzip: +Infinity%
@material-ui/lab: parsed: +Infinity% , gzip: +Infinity%
TextField: parsed: +Infinity% , gzip: +Infinity%
@material-ui/unstyled: parsed: +Infinity% , gzip: +Infinity%
SpeedDialAction: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Select: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Menu: parsed: +Infinity% , gzip: +Infinity%
Tooltip: parsed: +Infinity% , gzip: +Infinity%
SwipeableDrawer: parsed: +Infinity% , gzip: +Infinity%
Alert: parsed: +Infinity% , gzip: +Infinity%
TabList: parsed: +Infinity% , gzip: +Infinity%
SpeedDial: parsed: +Infinity% , gzip: +Infinity%
Pagination: parsed: +Infinity% , gzip: +Infinity%
Drawer: parsed: +Infinity% , gzip: +Infinity%
Popover: parsed: +Infinity% , gzip: +Infinity%
LoadingButton: parsed: +Infinity% , gzip: +Infinity%
Dialog: parsed: +Infinity% , gzip: +Infinity%
and 269 more changes

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 7a800c3

@zannager zannager requested a review from DiegoAndai March 12, 2025 07:37
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

LGTM

May I ask you to do a final test with the example in #45210 (comment) (where this was originally discovered). Just to make sure it's fixed with this change.

@siriwatknp siriwatknp enabled auto-merge (squash) March 17, 2025 15:21
@siriwatknp siriwatknp merged commit 2c9b7b8 into mui:master Mar 18, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[material-ui] mergeSlotProps doesn't handle functions
3 participants