-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] Wrong grid item width for nested containers with custom columns prop #30209
Comments
I'm not sure if I understand the problem. I tried to reproduce it in codesandbox using the code you provided (I used 5-column grid for better visibility): https://codesandbox.io/s/proud-shape-gz9n1?file=/src/Demo.tsx The whole grid is 500px wide and the grey and green cells have 200px and 100px respectively, as I expected. Could you explain in more detail what you would expect? |
Hi @michaldudak , |
@AlexKrupko indeed, this doesn't look correct. |
@alonmatthew and I found if you set the nested columns grid explicitly to: However, if you set either of these, it will work:
|
@michaldudak Is there somewhere in the documentation that says Grid's should inherit their parent Grid container's column prop? IMO this is not intuitive. I would expect the nested grid here to be 12 columns, as is default: Here's an example of trying to manually override it in a basic shorthand use case but it doesn't work: Hacky version to get it to actually override:
|
No, I believe it shouldn't work like that and it's a bug. The columns prop should behave the same no matter if it's a top-level or nested grid. Would you like to take a look at it and contribute a fix? |
@michaldudak Sure. Thanks for clarifying. |
Hi @michaldudak, I think @ConnerAiken isn't available, I will work on this. |
Thanks @boutahlilsoufiane, my 9-5 is blocking me from helping. |
Hi @michaldudak, I created a PR for this, could you please review It? thanks a lot. |
Duplicates
Latest version
Current behavior 😯
Cell width is calculating incorrect for nested containers with custom
columns
prop.So, the value of
columns
prop from top-level container is used for calculating all item widths. All nestedcolumns
props are ignored.I guess, this issue is related to #28554
Expected behavior 🤔
Cell width should be calculating based on
columns
prop value of the parent grid container.Steps to reproduce 🕹
No response
Context 🔦
No response
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: