[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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][Grid] Spacing doesn't work when using css variables. #44662

Closed
1 task done
DiegoAndai opened this issue Dec 5, 2024 · 1 comment · Fixed by #44663
Closed
1 task done

[material-ui][Grid] Spacing doesn't work when using css variables. #44662

DiegoAndai opened this issue Dec 5, 2024 · 1 comment · Fixed by #44663
Assignees
Labels
component: Grid The React component. package: material-ui Specific to @mui/material regression A bug, but worse

Comments

@DiegoAndai
Copy link
Member
DiegoAndai commented Dec 5, 2024

Created from #44376 (comment).

Latest version

  • I have tested the latest version

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/react-ziw5rb?file=Demo.tsx,package.json
  2. Toggle the checkbox, which turns on and off the CSS variables mode
  3. Notice how the grid shifts

Current behavior

Original report (#44376 (comment))

When you are combining Container with Grid then the margin-top and margin-left is not calculated properly for the Grid or maybe for the Container - hard to say; but this change definitely caused that.

Look

before Zrzut ekranu 2024-11-28 o 17 08 17 Zrzut ekranu 2024-11-28 o 17 08 25
after Zrzut ekranu 2024-11-28 o 17 06 50 Zrzut ekranu 2024-11-28 o 17 07 09

The difference is on Grid element that margin top and left styles changed:
from:

    margin-top: calc(-2* var(--mui-spacing));
    margin-left: calc(-2* var(--mui-spacing));

to:

    margin-top: -calc(2* var(--mui-spacing));
    margin-left: -calc(2* var(--mui-spacing));

Worth to mention that before variable era everything was alright with the styles

Search keywords

grid css variables spacing

Your environment

npx @mui/envinfo
    "react": "19.0.0",
    "react-dom": "19.0.0",
    "@mui/material": "6.1.10",
    "@emotion/react": "11.13.5",
    "@emotion/styled": "11.13.5",
    "@types/react": "18.3.13",
    "@types/react-dom": "18.3.1",
@DiegoAndai DiegoAndai added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 5, 2024
@DiegoAndai DiegoAndai self-assigned this Dec 5, 2024
@DiegoAndai DiegoAndai added bug 🐛 Something doesn't work regression A bug, but worse component: Grid The React component. package: material-ui Specific to @mui/material and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer bug 🐛 Something doesn't work labels Dec 5, 2024
Copy link
github-actions bot commented Dec 9, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. package: material-ui Specific to @mui/material regression A bug, but worse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant