Wrong CSS specificity
See original GitHub issueTake the following style as an input:
const style = {
root: {
"&:hover": {
"& .icon": {
color: "red"
}
},
"&.active": {
"& .icon": {
color: "blue"
}
}
},
};
Expected behavior: I would expect the following CSS injected into the page:
.root-0-0-1:hover .icon {
color: red;
}
.root-0-0-1.active .icon {
color: blue;
}
Describe the bug: The following CSS is injected in the page:
.root-0-0-1.active .icon {
color: blue;
}
.root-0-0-1:hover .icon {
color: red;
}
Codesandbox link:
https://codesandbox.io/s/yjyqmo4vqv
Versions (please complete the following information):
- jss: 10.0.0-alpha.11
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Specificity - CSS: Cascading Style Sheets - MDN Web Docs
Specificity is an algorithm that calculates the weight that is applied to a given CSS declaration. The weight is determined by the number...
Read more >How to tackle CSS specificity issues and when to use the ...
If the CSS selectors with conflicting CSS rules have equal specificity, then the browser will use the source order rule and apply the...
Read more >Specificity Error - CSS - Stack Overflow
So when calculating the specificity of some CSS code I came across with something I find contradictory. According to the "formula" (inline >...
Read more >Specifics on CSS Specificity
The best way to explain it is to start with an example of where specificity gets confusing and perhaps doesn't behave like you...
Read more >Importance of CSS Specificity and its best practices
CSS selector with more specificity in the list of selectors, the more likely it will be applied on the element. It's always bad...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The workaround:
Featured in https://github.com/mui-org/material-ui/pull/14650.
Are there any updates?