-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[DataGrid] Fix fluid columns width when available viewportWidth
< 0
#1816
[DataGrid] Fix fluid columns width when available viewportWidth
< 0
#1816
Conversation
packages/grid/_modules_/grid/hooks/features/columns/useGridColumns.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a reproduction, e.g. there is almost no information on the linked issue. What's the issue?
I'll add a reproduction but the issue is that if you have only one fluid column (as a base case) and you start resing the grid, there is a point where there is no space for the fluid column to be displayed and the grid doesn't allow scrolling so you cant see the last X columns. PS: @oliviertassinari I added reproduction |
@DanailH Great thanks for the reproduction 🙏! We can probably rely on a visual test case here. It seems to be exactly this pain #1561 (comment). In the realm of AG Grid, this would be expected behavior, and they would tell us: add a |
@oliviertassinari Visual test can be tricky in this situation as this only happens when you load the grid and then resize the window so that there isn't enough space for all the columns that already have fixed width. If you load the grid in a small space/window initially the regression doesn't happen. |
@DanailH I'm completely lost. I don't understand where the problem is, why visual regression isn't possible, nor what this PR is changing. See the following: HEAD: The last column is not visible, looks alright ✅, flex: 1 means it should shrink. https://codesandbox.io/s/material-demo-forked-y2xj0?file=/demo.js:0-587 This PR: Same behavior as on HEAD https://codesandbox.io/s/material-demo-forked-y8m1q?file=/package.json |
I mean, see how CSS behaves: flex: 1: And with the same configuration of the columns: https://codepen.io/oliviertassinari/pen/XWMExoz I wouldn't expect width: 100px here for the age column. I think that it only makes sense if we add |
@oliviertassinari This PR is fixing the negative widths when there's no available space. A visual test case would not check that but an unit test can.
So default it to zero? |
@m4theushw I think that it should use the default |
@oliviertassinari the thing is that there is no |
@DanailH Ok, so we can close this PR, close #1582, and open a new standalone issue for #1561 (comment) (solving with a new min-width option)? The reasoning being: |
@oliviertassinari Done, here is the ticket #1850. We can discuss it today during the sprint planning and bring it in. |
By close, I meant close, not merge, the behavior is now inconsistent. But it's fine, we can revert in #1850. Thanks for the new issue. |
Sorry I misunderstood. I'll change that once the other ticket is picked up. |
Fixes #1582
Reproduction: https://codesandbox.io/s/material-demo-forked-y2xj0 (when the grid loads start resizing the window to make it small to a point where the last column dissapears)
The problem was that when resizing and space was not enough the fluid columns did not default to the base width of
100px
.Screen.Recording.2021-06-03.at.16.25.05.mov