Fixes emotion compat, className overwriting more specific classes#33866
Fixes emotion compat, className overwriting more specific classes#33866garronej wants to merge 1 commit intomui:masterfrom garronej:classes_ordering
Conversation
mnajdova
left a comment
There was a problem hiding this comment.
This will complicate things too much, it would mean that in each component we will need to merge the className prop at specific location. More over, how do we decide what "more specific classes" mean? I am saying this because there is no such thing as a more specific class, there are more specific selectors.
| const slots = { | ||
| root: [ | ||
| 'root', | ||
| 'className', |
There was a problem hiding this comment.
| 'className', |
This will generate class name: MuiTab-className
There was a problem hiding this comment.
This will generate class name: MuiTab-className
Sorry my implementation was naive, obviousy we dont wantMuiTab-className.
OK I understand why you don't see it as being worth fixing.
While I agree that I didn't phrase it correctly, I disagree on the fact that there is an ambiguity on what the expected behavior is. <Tab
icon={<PhoneIcon />}
label="Background should be green"
className={css({ backgroundColor: 'red' })}
classes={{
labelIcon: css({ backgroundColor: 'green' })
}}
/>Any classes specified in the Anyway, I can make this work with a hack on TSS side so, no worries, feel free to close. As always, thanks for reviewing @mnajdova! |
Let's try to go with this first.
Sure |
Hi,
This PR is related to #33205.
What is happening is that
classNamesoverwrites theclassesthat applies to the root component.I have implemented a fix for the
Tabcomponent. If you are fine with it I can generalize it.The visual test case can be run with:
Then accessing: http://localhost:3000/regression-Table/EmotionCompat#no-dev
With this branch you'll get:

With

mui/material-ui#master:Best regard,