-
-
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
[material-ui] Support Pigment CSS for CssBaseline
, ScopedCssBaseline
and Popper
#42640
Conversation
Netlify deploy previewhttps://deploy-preview-42640--material-ui.netlify.app/ ScopedCssBaseline: parsed: +11.09% , gzip: +8.41% Bundle size reportDetails of bundle changes (Toolpad) |
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.
Only one question
@@ -13,7 +17,8 @@ export const html = (theme, enableColorScheme) => ({ | |||
// Fix font resize problem in iOS | |||
WebkitTextSizeAdjust: '100%', | |||
// When used under CssVarsProvider, colorScheme should not be applied dynamically because it will generate the stylesheet twice for server-rendered applications. | |||
...(enableColorScheme && !theme.vars && { colorScheme: theme.palette.mode }), | |||
...(enableColorScheme && | |||
!theme.vars && { [`&:has(.${SELECTOR})`]: { colorScheme: theme.palette.mode } }), |
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.
Glad we bump safari to 15.4, otherwise I have no clue how to make it work 😊
@@ -71,7 +80,8 @@ function CssBaseline(inProps) { | |||
const { children, enableColorScheme = false } = props; | |||
return ( | |||
<React.Fragment> | |||
<GlobalStyles styles={(theme) => styles(theme, enableColorScheme)} /> | |||
<GlobalStyles /> | |||
{enableColorScheme && <span className={SELECTOR} style={{ display: 'none' }} />} |
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.
What’s the need for enableColorScheme: false
?
In other words, why would anyone want the browser to show light color scheme for a dark theme?
Having a hanging span
element is another freak (break of principle of least surprise).
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.
That's a good argument, I think we should revisit in v7. For v6 we try to keep the breaking changes minimal, so I wouldn't just the API just yet, only add the opt in support for Pigment CSS.
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.
Can we do the opposite here? Only a DOM node if the prop is false?
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.
Good point, done.
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.
Can we please add some examples with this components? Just to verify everything works as before.
Added the demo page and capture the clip in the PR description. |
…ne` and `Popper` (mui#42640)
Part of #41273
Screen.Recording.2567-06-21.at.15.34.32.mov