-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Box styles don't have highest priority #24277
Comments
Duplicate of #18496 |
|
@oliviertassinari regarding #2 are you referring to this https://material-ui.com/styles/advanced/#css-injection-order? I've read that but I don't understand how that affects Box component styles. I understand I can tell it where to inject all material styles in the head but what I don't understand is how to tell it to always put only Box styles to the bottom. And import order doesn't seem to work for me either as importing the Box last doesn't help. |
@jbojcic1 In your case, the simplest is to upgrade to v5: you get the |
When you wrap syled component with Box with clone set to true, the Box styles should override the styles of the styled component.
Current Behavior 😯
Box styles are overridden by the inner styled component styles.
Expected Behavior 🤔
Docs state:
⚠️ The CSS specificity relies on the import order. If you want the guarantee that the wrapped component's style will be overridden, you need to import the Box last.
So my understanding is that Box styles should override the styles of the styled component if Box is imported last.
Steps to Reproduce 🕹
https://codesandbox.io/s/charming-feather-yji6s?file=/src/App.js
Notice how width of inner styled div wins over Box width even though I imported box last.
The text was updated successfully, but these errors were encountered: