-
-
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
[data grid] Fix renderContext
calculation with scroll bounce / over-scroll
#16297
Conversation
Deploy preview: https://deploy-preview-16297--material-ui-x.netlify.app/ |
There's a pre-existing issue with the below grid / test – it should not have a vertical scrollbar. The issue is that the grid footer grows and forces the main container to shrink. Main container should, however follow its children's height. https://app.argos-ci.com/mui/mui-x/builds/29689/132441281 Added Edit: reverted, as it broke some tests. But the issue is there still if anyone wants to take a look, will leave it out of this PR. Alternatively, it could be beneficial for |
This reverts commit 0bb51cc.
11b8382
to
4ecb631
Compare
This seems to do it: Before Screen.Recording.2025-01-27.at.15.53.17.movAfter: Screen.Recording.2025-01-27.at.15.52.18.movOn how we write tests to prevent future regressions, I'm not sure. |
renderContext
calculation with scroll bounce / over-scrollrenderContext
calculation with scroll bounce / over-scroll
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.
Thanks a lot for the PR @lauri865
packages/x-data-grid/src/components/virtualization/GridVirtualScrollbar.tsx
Outdated
Show resolved
Hide resolved
packages/x-data-grid/src/components/virtualization/GridVirtualScrollbar.tsx
Outdated
Show resolved
Hide resolved
…Scrollbar.tsx Co-authored-by: Kenan Yusuf <kenan.m.yusuf@gmail.com> Signed-off-by: Lauri <lauri.lehtmaa@gmail.com>
…Scrollbar.tsx Co-authored-by: Kenan Yusuf <kenan.m.yusuf@gmail.com> Signed-off-by: Lauri <lauri.lehtmaa@gmail.com>
packages/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx
Outdated
Show resolved
Hide resolved
…VirtualScroller.tsx Signed-off-by: Kenan Yusuf <kenan.m.yusuf@gmail.com>
LTR ltr.movRTL rtl.movPinned columns pinned-columns.mov |
Cherry-pick PRs will be created targeting branches: v7.x |
…-scroll (#16297) Signed-off-by: Lauri <lauri.lehtmaa@gmail.com> Signed-off-by: Kenan Yusuf <kenan.m.yusuf@gmail.com> Co-authored-by: Kenan Yusuf <kenan.m.yusuf@gmail.com>
…-scroll (mui#16297) Signed-off-by: Lauri <lauri.lehtmaa@gmail.com> Signed-off-by: Kenan Yusuf <kenan.m.yusuf@gmail.com> Co-authored-by: Kenan Yusuf <kenan.m.yusuf@gmail.com>
Fixes an age old bug that has made the Datagrid look really broken on iOS devices.
Turns out there's a faulty logic that prevents renderContext from being recalculated when overscrolling – it skips calculating a new render context if the scroller is out of bounds, which results in blank rows intermittently. Fixed it by clamping within the known scroll area instead to avoid any unnecessary recalculations when bouncing, while still updating the render context when needed.
Steps to reproduce:
It's very annoying, since there's no directional scroll locks, so natural motion can easily trigger even the tiniest of overscrolls and this bug looks like this (no rows displayed while actively scrolling):
https://github.com/user-attachments/assets/d431e8f3-60c0-4914-b098-ed901195e38c
I also added in a small performance optimisation to reduce the number of calls to
scrollTop/scrollLeft
properties (centralised totriggerUpdateRenderContext
), which can cause re-measurements when called in different times (depends on browser implementation).Fixes #14930 (was never solved)
Preview: https://deploy-preview-16297--material-ui-x.netlify.app/x/react-data-grid/#pro-version