-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Modal] has inline styles instead of classes. Breaks support of classes API #16442
Comments
@burtyish Correct, you have to use
Yes, removing the imports to JSS has yielded a significant bundle size reduction. We were at 24 kB gzipped before #15466, we are at 5 kB gzipped now for a single import of the Modal. |
Just to be clear: You didn't save 19kB in a bundle using material-ui. Only if the Modal was the only component you used. |
@eps1lon Yes, this statement is accurate. It's slightly bigger actually. |
@oliviertassinari Are there any AI going forward here - i.e. is this something that's going to be changed (ideally), or is the inline-style going to be kept, making it hard to override (force the need to use |
@oliviertassinari I wanted to override the |
I believe I am having a similar issue trying to change the root backgroundColor on the backdrop. Seems like https://codesandbox.io/s/material-demo-vm0qu This previously worked in 3.x and matches the documentation that I see for Backdrop. Is this the new way going forward for modifying the Backdrop style? |
@jsheetzati Correct. |
It is not clearly pointed here and my issue is closed (#16605) - It's not only about overriding styles API but also about using theme's default props override feature. See more in the issue. |
Popover API docs still indicate a ModalClasses |
Another option to override default z-index is to just pass a |
@mnajdova This one might require a tricky tradeoff for the unstyled components. We might want to keep the inline style for simplicity. It seems to be what react-modal does without any major downsides. However, if we do, we make overrides harder, so better be sure the styles rarely need to be overridden. |
I agree. I will dig more into it tomorrow and try to prototype how it would look like. Also, just food for thought, if the unstyled component uses |
Once we have the separation of unstyled and core versions of the component, I think we will have the best from both worlds ( unstyled version with minimal bundle size) and the styled version with the default styles using emotion/styled-components based on the setup. |
Expected Behavior 🤔
Overriding a Dialog's style class worked in version 3.x, I expected this to continue working. I didn't see anything about this mentioned in the migration guide, under Dialogs.
I do see the following. Is it related? That's not clear.
Current Behavior 😯
The dialog's root div is assigned the class
MuiDialog-root
, but this class has no CSS styles defined.The class I assigned via the class API has no effect, since the inline styles have higher specificity.
Steps to Reproduce 🕹
Link: https://codesandbox.io/s/material-ui-dialog-issue-16442-srl0e
Context 🔦
In my app, I may have more than a single open dialog (yeah, I know it's bad UX, sorry). So this method is what we use to ensure the dialogs are in a certain order.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: