-
-
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
[Grid] Fix support for CSS variables #42574
Conversation
Netlify deploy previewhttps://deploy-preview-42574--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
function getOffset(val) { | ||
const parse = parseFloat(val); | ||
if (Number.isNaN(parse)) { | ||
return val; | ||
} | ||
return `${parse}${String(val).replace(String(parse), '') || 'px'}`; | ||
} |
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.
I believe we can drop this since we have this new constraint: https://mui.com/material-ui/migration/v5-style-changes/#%E2%9C%85-remove-px-suffix.
It seems impossible to have values without units:
return typeof output === 'number' ? `${output}px` : output; |
147b14a
to
1f84b37
Compare
@@ -155,6 +155,36 @@ describe('system spacing', () => { | |||
expect(output).to.deep.equal({ padding: '-2em' }); | |||
}); | |||
|
|||
it('should support CSS variables single value', () => { |
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.
I feel these tests were missing a bit from #40224. There are present, but higher up in the abstraction chain. Not that important though;
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 the fix.
The Grid is broken when using CSS variables, the regression was introduced in #40224 (visible on the description of that PR).
Before
-calc(
doesn't workhttps://next--material-ui.netlify.app/core/
After
https://deploy-preview-42574--material-ui.netlify.app/core/
Now, I imagine that during v6 lifecycle we will deprecate https://mui.com/material-ui/react-grid/ for https://mui.com/material-ui/react-grid2/. But first, we will need to migrate all our marketing pages to use the new grid. And even once we do, the deprecated version should continue to work with CSS variables so developers can migrate to it.