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

[Grid] large spacing causes horizontal overflow #21507

Closed
2 tasks done
ohlr opened this issue Jun 19, 2020 · 8 comments
Closed
2 tasks done

[Grid] large spacing causes horizontal overflow #21507

ohlr opened this issue Jun 19, 2020 · 8 comments
Labels
component: Grid The React component. duplicate This issue or pull request already exists

Comments

@ohlr
Copy link
Contributor

ohlr commented Jun 19, 2020

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Overflow with large spacing

Expected Behavior 🤔

No overflow with large spacing

Steps to Reproduce 🕹

Include code to reproduce,:
https://codesandbox.io/s/wispy-monad-zqwlf?file=/src/Demo.js
https://zqwlf.csb.app/

On small browsers a horizontal scrollbar appears beacause of overflow.
Issue is only present for large spacing

@ohlr ohlr added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 19, 2020
@tchmnn
Copy link
Contributor

tchmnn commented Jun 19, 2020

Hey @ohlr,
I think this is known behaviour.
I found this section in the docs: https://material-ui.com/components/grid/#negative-margin
Notice how the scrollbar disappears when a padding to the container is applied.
https://codesandbox.io/s/lucid-davinci-v407s?file=/src/Demo.js

(v1 to v4)

@ohlr ohlr closed this as completed Jun 19, 2020
@oliviertassinari oliviertassinari added support: question Community support but can be turned into an improvement and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 19, 2020
@ohlr
Copy link
Contributor Author

ohlr commented Jun 20, 2020

Thank you @tchmnn, somehow I always overread that part of the docs

@oliviertassinari oliviertassinari added the component: Grid The React component. label Jun 20, 2020
@otaviobonder-deel
Copy link

@tchmnn if I want to use a full-width Grid with a background-color, applying a padding to the parent element will make my Grid shrink, and I'll have different color borders (background one color, grid another color). What's the best approach in this case?

@tchmnn
Copy link
Contributor

tchmnn commented Jul 16, 2020

@otaviobps
I'm sorry, I'm not sure if I understand your question 😄
Would you mind rephrasing or visualizing it? Or maybe provide a codesandbox reproducing your issue.

@otaviobonder-deel
Copy link

Hey @tchmnn thanks for replying.

I made a question at stack overflow about it: https://stackoverflow.com/questions/62942858/how-to-use-material-ui-grid-for-spa-negative-margin-problem

Thanks!

@oliviertassinari
Copy link
Member

The issue is fixed in v5. For instance, with @otaviobps's reproduction: https://codesandbox.io/s/friendly-wescoff-xvukw?file=/src/Demo.js. It was fixed in #24332.

@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists and removed support: question Community support but can be turned into an improvement labels Apr 15, 2021
@oliviertassinari
Copy link
Member

Duplicate of #7466

@oliviertassinari oliviertassinari marked this as a duplicate of #7466 Apr 15, 2021
@EugeneGohh
Copy link

Hey @ohlr,
I think this is known behaviour.
I found this section in the docs: https://material-ui.com/components/grid/#negative-margin
Notice how the scrollbar disappears when a padding to the container is applied.
https://codesandbox.io/s/lucid-davinci-v407s?file=/src/Demo.js

It works, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants