Comments (8)
OK, thank you for the extra details.
I was making sure there wasn't anything I can do for you and I am afraid this is effectively the case.
In defense of the MUI team, if they are facing all theses specificity issues it is because they are allowing users to use styled-component
instead of @emotion
as underlying style engine. ref. It makes their job 10 times harder, I am not sure it's worth it.
from tss-react.
Got it, I understand it's not an easy job to support customization, especially with more than one CSS engine. In any case, thanks for you help, feel free to close this issue and let's see if someone from MUI can help or if we just need to refactor the code to increase specificity.
from tss-react.
I checked MUI's issues as well and the only partially related thing I found is mui/material-ui#30727
But it's about "state" rules, while in my case I'm overriding sub-component (slot).
I also took a look on the implementation of Chip
to see how classes
"resolution" is implemented but I got lost in it. But I can see now that they internally generate styles with specificity 2 for the sub-components: https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/Chip.js#L139
But then I'm not sure why classes
is exposed at all, if it only can add new style props. Unless I'm missing something important here 🙂
from tss-react.
Hi @synaptiko,
I might be able to do something about it but I am not sure.
Is the problem that the collor in the root
take priority over the color in deleteIcon
?
PS: Maybe related: #38
from tss-react.
The issue is specifically about sub-component. Even if color
from root
is removed, the problem persist. And it's not only about Chip
, I had similar issue with a few other components.
Thank you, I'll try to get help from MUI.
from tss-react.
Is it that (1) doesn’t take precedence over (2) ?
deleteIcon: {
color: theme.palette.primary.contrastText, // (2)
'&:hover': {
color: `${theme.palette.primary.contrastText}6`, // (1)
},
},
Or is it that neither (1) nor (2) take precedence over an internal MUI style that defines color
?
from tss-react.
@garronej It's about specificity of what's generated by withStyles
/makesStyles
vs what's used by MUI internally for deleteIcon
. I've added :hover
only as an additional thing one could override but it's not specific to it. Even without :hover
the color is not correct as it can be seen here: https://muiv5-problem-with-classes.vercel.app/
Here are the generated styles:
What's coming from MUI is .mui-hke119 .MuiChip-deleteIcon
and what's coming from makeStyles
is .tss-wtj64x-deleteIcon
. But I would expect classes
will merge both under .mui-hke119 .MuiChip-deleteIcon
.
from tss-react.
I'm interested to have the follow up on this.
And feel free to come back if you think there is something I can do from TSS-react.
from tss-react.
Related Issues (20)
- Mui Popper style not applied HOT 2
- Import module error with Vite JS HOT 9
- lint errors with 4.8 but not with 4.7.7 HOT 2
- MUI styles overriding Tss react styles while upgrading to MUI v5 HOT 11
- Mixing multiple classes with nested selectors can lead to undesired output HOT 1
- eslint-plugin-tss-unused-classes detects every class as unused HOT 1
- Missing classname escaping HOT 1
- FOUC when using NextAppDirEmotionCacheProvider with prepend true HOT 8
- How to opt out of RTL transformation? HOT 3
- <GlobalStyles /> don't work properly with next.js app folder HOT 7
- cannot Import multiple makeStyles HOT 1
- Use eslint rule to detect unused classed with imports HOT 2
- React 16.10.0 failed to install @ mui/material HOT 1
- How to use with css and styled apis. HOT 1
- yarn install with pnp mode complains about missing dependency @mui/material HOT 3
- NextJS/MUI/TSS - Cannot read properties of undefined (reading 'classes') HOT 3
- Hard reload after any file change HOT 2
- TssCacheProvider is not working when used with emotion cache and mui 5 HOT 6
- Using with Shadowed Web Components HOT 3
- Next.js: Applying augmentDocumentWithEmotionCache to document breaks AMP pages HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tss-react.