-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
[system] Fix breakpoint order #26773
Conversation
Details of bundle changes.Comparing: 4f45597...a976d06 Details of page changes
|
We worked on a similar problem in #23380. Maybe we need to use |
@@ -28,3 +28,33 @@ describe('breakpoints', () => { | |||
}); | |||
}); | |||
}); | |||
|
|||
describe('handleBreakpoints', () => { |
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.
This is a private module. Could we reorganize the test case to cover a public API that reproduces the bug? This is important because our current focus with the system is to make it works and right, fast will come after and likely require to reorganize the internal API.
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.
@oliviertassinari Just one public api it's worth? Because I reproduced it at least on two APIs (spacing, flexbox).
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.
Ideally, with the sxFunction converter, otherwise, style
, https://github.com/mui-org/material-ui/blob/c795ca0822e2816a630a5654d5471fa04521d23c/packages/material-ui-system/src/flexbox.js#L4
@oliviertassinari Do you think that we should bring the "same" code from next to master? That's some point different there? |
@renatoagds Oh, I didn't realize we are on master. Please rebase on next. We haven't been working on master (v4) for 12+ months. |
@oliviertassinari this is a bug that's happening on latest release (v4), I could confirm if happens on v5, but for v4 the branch that is being used is master or not? |
v4 -> master branch, v5 -> next branch. |
I've just checked and it works with v5. |
@mnajdova Not completely. I can reproduce the issue with: import * as React from "react";
import { styled } from "@material-ui/core/styles";
import Grid from "@material-ui/core/Grid";
import Paper from "@material-ui/core/Paper";
import Box from "@material-ui/core/Box";
const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2,
padding: theme.spacing(1),
textAlign: "center",
color: theme.palette.text.secondary
}));
export default function RowAndColumnSpacing() {
return (
<Box sx={{ width: "100%" }}>
<Grid container columnSpacing={{ lg: 5, sm: 1 }}>
<Grid item xs={6}>
<Item>1</Item>
</Grid>
<Grid item xs={6}>
<Item>2</Item>
</Grid>
</Grid>
</Box>
);
} https://codesandbox.io/s/priceless-cohen-q14i7?file=/src/App.js |
@oliviertassinari so, can I follow with this fix for v4 (fixing the comment about the test) and prepare a new one for v5? |
When you use an prop as object, following the breakpoint approach, if the object do not follow the size order:
p={{ md: .., sm: ..., xs: ... }}
It won't work, since the priority comes right to left.
An example could be found here: https://codesandbox.io/s/keys-order-mui-v8qjb?file=/src/App.js
Just open the sandbox and resize the browser panel, you will see that yellow box never changes the padding.
This is an bug dectected after use eslint sort-keys rule: https://eslint.org/docs/rules/sort-keys