-
-
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
[docs] Improve the CssBaseline description #16148
Conversation
No bundle size changes comparing 85058cc...7a40215 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Though @oliviertassinari might have had a reason it was put in this specific place.
Could it explain why it's a but? I believe your typography color (none by default) should have priority over your palette color. |
I'm closing, the order is important. |
This comment has been minimized.
This comment has been minimized.
Could you add a test or explain why this is important? Current behavior is very opaque. |
The CssBaseline component should apply the We should update the documentation: https://material-ui.com/components/css-baseline/#typography. |
@oliviertassinari In the case I'm referencing the current order is a problem because it may cause unintended color side effects for header tags. They end up inheriting the now defined I would be under the belief that the Correct me if I'm wrong, but then an implemented Typography element of type |
Hmm, changing it might be a breaking change. I would expect body2 colours to override the primary text colour but I’m more than happy to be convinced otherwise. Looks like createTypography contains a unneeded comment though? https://github.com/mui-org/material-ui/blob/045dadc4609acb756adc74fcbf1a5150a054e14e/packages/material-ui/src/styles/createTypography.js#L36 Edit: I’m back to talking myself in circles. On one point I think it’s weird to have colours in typography declarations but I can see that they might be and they should overwrite if someone wants it to |
@joshwooding It may come down to a matter of implementation opinion. I expected to be able to override the color of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing the detail of your use case! I can imagine the confusion. Now, I believe that what you are describing is what we expect. in v4, we have changed the typography to be colorless by default. The color inherits for all the variants. The CssBaseline apply the body2 variant style so you can use this Typography component less frequently.
To solve your problem, I would probably extend the Typography to support a new color prop value or a new typography variant.
Fixes bug in CssBaseline where spreading
theme.typography.body2
attributes overwrites default body font colors (if they exist onbody2
for some reason).