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

[DataGrid] Fix layout when rendered inside a parent with display: grid #8577

Merged
merged 5 commits into from
May 11, 2023

Conversation

@cherniavskii cherniavskii added component: data grid This is the name of the generic UI component, not the React module! regression A bug, but worse feature: Rendering layout Related to the data grid Rendering engine plan: Pro Impact at least one Pro user labels Apr 11, 2023
@mui-bot
Copy link

mui-bot commented Apr 11, 2023

Netlify deploy preview

Netlify deploy preview: https://deploy-preview-8577--material-ui-x.netlify.app/

Updated pages

No updates.

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 638.2 1,182.9 638.2 861.44 203.751
Sort 100k rows ms 673.5 1,398.8 1,398.8 1,049.26 233.662
Select 100k rows ms 222.7 375.2 327.5 302.76 54.734
Deselect 100k rows ms 144.3 353.2 189.2 240.36 90.861

Generated by 🚫 dangerJS against d7696ee

@cherniavskii cherniavskii marked this pull request as ready for review April 11, 2023 12:19
Comment on lines 117 to +118
display: 'flex',
overflow: 'hidden',
Copy link
Member

@MBilalShafi MBilalShafi Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution works for displays grid and flex but for table it still causes the same issue. I played around and display: grid seems to solve all the cases, do you see any caveats in changing root element's display property from flex to grid 🤔

Suggested change
display: 'flex',
overflow: 'hidden',
display: 'grid',

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately display: grid causes regressions like this one https://codesandbox.io/s/sad-spence-dv82dy and more (at least 12 unit tests fail).

Thanks for pointing out the issue with display: table, I'll look into it!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBilalShafi
I think the behavior with display: table is expected.
I created this demo with a simple GridMock component and I believe the data grid should behave in the same way:
https://codesandbox.io/s/datagrid-6-0-0-in-grid-forked-fb4yjg?file=/demo.tsx

Screenshot 2023-04-22 at 16 38 43

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, so that's how display: table natively works. Thanks for providing the demo.

@cherniavskii cherniavskii merged commit 1386e9a into mui:master May 11, 2023
@cherniavskii cherniavskii deleted the fix-layout-inside-grid-parent branch May 11, 2023 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Rendering layout Related to the data grid Rendering engine plan: Pro Impact at least one Pro user regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] v5 worked fine inside "display: 'grid'" but v6 doesn't work properly
3 participants