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][styled-engine-sc] Fix ownerstate being propagated to DOM node #39586

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Oct 24, 2023

This PR fixes #38431 (comment). Starting from v6 styled-components no longer blocks the invalid props used on components created with the styled() util. In 4 of the Material UI components we are using a tag without specifying a slot name for it primitive tag without specifying slot name for it. For all of these components, all props propagated are ending up on the DOM element. This PR adds explicitly a shouldForwardProp on these places. @siriwatknp we will need to apply the same on Joy UI in cases where we don't have specified slot on the styled component.

Previous (search for ownerstate in the DOM inspector): https://codesandbox.io/s/styled-components-forked-pxgs8h?file=/src/demo.js
Now (if it wants to load): https://codesandbox.io/s/styled-components-forked-tjtlgp?file=/src/demo.js

@mnajdova mnajdova added package: material-ui Specific to @mui/material package: styled-engine-sc Specific to styled-components labels Oct 24, 2023
@mui-bot
Copy link

mui-bot commented Oct 24, 2023

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 5e624fe

@mnajdova mnajdova merged commit 64c48b5 into mui:master Oct 27, 2023
21 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 package: styled-engine-sc Specific to styled-components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[styled-engine-sc] Add support for styled-components v6
4 participants