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

In v6, Grid columnSpacing misbehaves with string pixel values like "16px" #44321

Closed
ChristopherChudzicki opened this issue Nov 4, 2024 · 2 comments · Fixed by #44376
Closed
Assignees
Labels
component: Grid The React component. regression A bug, but worse v6.x

Comments

@ChristopherChudzicki
Copy link

ChristopherChudzicki commented Nov 4, 2024

Steps to reproduce

Link to live example: (required)

Steps:

  1. View editable example with v6: https://stackblitz.com/edit/react-hp2ukf?file=Demo.tsx
  2. Note that specifying columnSpacing="16px" produces extra space on left.

Current behavior

When specifying columnSpacing on Grid using pixels, there's extra space to the left of the grid items.

Note: Locally in development, but not on stackblitz, I can see margin-left: NaNpx on <div class="MuiGrid-root MuiGrid-container">.

Expected behavior

No extra space.

Context

We recently updated MUI from v5 to v6.1.6. I have just noticed this behavior and believe it is a regression. (Edit: I've added a corresponding stackblitz demo for v5)

I understand that Grid2 is preferred now, however we have not had a chance to update all the Grid components yet.

Your environment

npx @mui/envinfo

Using Chrome. Note: This envinfo is for my local, not Stackblitz

  System:
    OS: macOS 14.3.1
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 130.0.6723.92
    Edge: Not Found
    Safari: 17.3.1
  npmPackages:
    @emotion/react:  11.13.3
    @emotion/styled:  11.13.0
    @mui/base:  5.0.0-beta.61
    @mui/core-downloads-tracker:  6.1.6
    @mui/lab:  6.0.0-beta.14
    @mui/material:  6.1.6
    @mui/material-nextjs:  6.1.6
    @mui/private-theming:  6.1.6
    @mui/styled-engine:  6.1.6
    @mui/system:  6.1.6
    @mui/types:  7.2.19
    @mui/utils:  6.1.6
    @types/react:  18.3.11
    react:  18.3.1
    react-dom:  18.3.1
    typescript:  5.6.3

Search keywords: grid, spacing, nan, negative

@ChristopherChudzicki ChristopherChudzicki added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 4, 2024
@zannager zannager added the component: Grid The React component. label Nov 5, 2024
@siriwatknp siriwatknp added regression A bug, but worse v6.x and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 11, 2024
@siriwatknp
Copy link
Member

Thanks for reporting, a PR to fix this issue has been created.

@DiegoAndai DiegoAndai moved this to In progress in Material UI Nov 11, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Material UI Nov 13, 2024
Copy link

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.

Note

@ChristopherChudzicki How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. regression A bug, but worse v6.x
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants