-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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] CSS rule "& > *" not working for some components after the migration from v4 to v5 #42066
Comments
Hey, thanks for opening the issue! Could you provide a minimal reproduction? It helps us troubleshoot. A live example would be perfect. This StackBlitz sandbox template may be a good starting point. |
I've found out the cause... this example I've shared is a simplified version of the real production code. What changes is that those buttons are actually custom buttons defined with
The margin defined by the |
@vinifmor It's interesting that it doesn't work. Could you create a before and after minimal StackBlitz showing the issue with your custom Button and the |
Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information. |
Steps to reproduce
I have to migrate an old Mui code from v4 to v5. There are some old CSS rules for direct children (
& > *
) that are not being applied. I'll provide some summarized codes below fore before/after the migration (v4 -> v5
):Before:
After (the the buttons' margin are not working):
The current workaround I've found is to provide the margin directly to the buttons through
sx={{ margin: theme => theme.spacing(1) }}
:Is this migrated code right ?
Current behavior
Margins not applied in v5 when the parent rule CSS
& > *
is definedExpected behavior
Margins should be applied
Context
Migration from v4 to v5
Your environment
Search keywords: migration
The text was updated successfully, but these errors were encountered: