-
-
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] Extra width of container & scrollbar #7466
Comments
I have found the same issue on flexboxgrid. I think that it's a limitation of our negative margin solution that implements the spacing. So you have 3 available workarounds:
<div style={{ padding: 20 }}>
<Grid container spacing={40}>
I'm closing as I can't think of a better alternative. If someone has a better solution for the spacing feature, please raise your voice :). |
To me, it seems like |
@hboylan In the light of all those issues open for this limitation, I'm starting to wonder! I wish we had access to some API usage analytics 📈 . |
I have added the |
At least 8 duplicated issues is a strong signal. I will add a note about this limitation in the documentation. |
Just wondering: Are there any caveats using the 2nd workaround you described? If not, you could add this in the Grid-container-Component per default? update: |
I'm unable to fix this in material-ui@next using |
flexboxgrid (which @oliviertassinari mentioned having the same issues) has a fork that claims to have fixed it. kristoferjoseph/flexboxgrid#144 (comment) I haven't dug into the code, but might be worth investigating to see if there's something we can use in Grid. |
Hi, We recently started adopting this library for one of our projects. You can imagine our surprise when we found out this thread. Basically this is a bug that's closed with no workarounds as of the latest material-next version. This is worrying. Do you guys have any procedures regarding bugs and bugfixes? Or is everything decided on the spot? This is the 1.0.0-prerelease: Extrapolating from this thread, shall we assume 1.0.0-prerelease actually has lots more bugs than what we see there? (i.e. this issue for example) How many valid material-ui bugs did you guys close so far on github, and instead of fixing you added text in the docs? Otherwise the framework is great. It's the procedures that are a bit worrying. Thank you, and I apologise if I offended anyone and/or if I came a bit strong. |
You certainly should (see: Issues). And you should expect 1.0.0-rc.x to have bugs too, but the API will be mostly stable. The timing of @ryanflorence's tweet is perfect.
If you know you're coming across a bit strong, don't apologize; rethink what it is you want to say, and how you want to say it. (And perhaps take a look at how much value you've got out of open source, vs. how much you've contributed, and decide if your complaint carries any weight.) Better still, if the workarounds provided in the docs aren't sufficient, get stuck in to the CSS and see if you can resolve the limitation that's bothering you. |
In desktop size I have images stretching all away to the side and fixing with xs={12} strangely made a padding appear. In my case the fix looks like @martjoao 's solution but only mobile width: |
I met a similar issue, and fixed by:
|
Ended up doing below:
This solves the issue. |
was just facing that issue as well and looking at the amount related issues i was wondering if it makes sense to fix this in material-ui. Couldn't we essentially do the same as they do here: imevro/flexboxgrid2@37e02fe#diff-4b62e0ae269a54df45ab5eab9cb7821b ? |
Ran into the same issue, found a semi-fix by doing <Container maxWidth={false}>
<Grid container spacing={3}>
<Grid item />
</Grid>
</Container> |
This fixed it fo me... thanks! |
Awesome solution! This fixed it for us, too. We had to add |
issue resolved after adding |
Thanks, this was the only working solution for me. |
Seems to work for me to omit the const theme = createMuiTheme({
overrides: {
MuiGrid: {
container: {
width: "100% !important",
// margin: "0 !important"
}
},
}
}); |
It's baffles me this ui framework has so many bugs. Your <div style={{ padding: 20 }}> wrapped around container grid workaround works. But it's not a solution. Grid should belong ANYWHERE. Bootstrap allows it everywhere without issues. They even have offsets to deal with these margin bugs. Is this ever going to get fixed? |
The problem with this is that you can still scroll. overflow-x: hidden is not a good solution |
|
I am shocked, I've been using MUI for maybe 2 years and never seen this before. Still not worked out why its happened. |
This solution works for me. This has been going on for so long it should be part of the documentation if a fix is not immediately possible. |
Is there any fix yet? |
The problem is still there. The solution overflow-x: hidden property on the parent |
Just another hack for this, which works for me ;)
those 2px seems to be added somewhere below my grid definition, so the actual value could be different for other people... |
This issue was fixed in v5 with #24332. |
Just make xs spacing 0 and add row spacing: |
The
<Grid container>
extends beyond its parent, with half of spacing size.I have marked the extra width in red, also setting spacing to zero fixes the problem.
Here is a working example: https://codesandbox.io/s/Y8nzGm5W.
Similar code with a zero spacing works as expected: https://codesandbox.io/s/NxvYxvQpL.
The text was updated successfully, but these errors were encountered: