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

[data grid] Fix choppy overlay resizing #16367

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lauri865
Copy link
Contributor

@lauri865 lauri865 commented Jan 28, 2025

Fixes choppy overlay resizing.

Currently, overlays depend on widths passed as style based on DOM measurements. This is not necessary though, and since updating dimensions is throttled, it can make overlays appear choppy when the viewport is resized.

Normally, this is not a problem, but with overlays it is:

  • Content is normally centred, so you see visible jumpiness
  • Semi-transparent backgrounds can leak through content when resizing

Best demo to test it on:
https://next.mui.com/x/react-data-grid/overlays/#custom-component

You see the centred content moving with a delay, and especially at breakpoints (but also when resizing fast or with an animation) you get a flash of the underlying content.

The issue:

before-choppy.mp4

After:

after-no-chop.mp4

@mui-bot
Copy link

mui-bot commented Jan 28, 2025

Deploy preview: https://deploy-preview-16367--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 42813fd

@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Jan 28, 2025
lauri865 and others added 3 commits January 29, 2025 18:31
Comment on lines +194 to +200
height: Math.max(
0,
viewportOuterSize.height -
topContainerHeight -
bottomContainerHeight -
(hasScrollX ? scrollbarSize : 0),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

For this PR and the other one, we need to document (breaking) changes to viewportInnerSize in https://github.com/mui/mui-x/blob/master/docs/data/migration/migration-data-grid-v7/migration-data-grid-v7.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is the plan to keep autoHeight around for the v8, given that it's already deprecated in v7?

Copy link
Member

Choose a reason for hiding this comment

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

It's not confirmed, but it's likely autoHeight will still be available in v8.

Copy link
Contributor

Choose a reason for hiding this comment

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

We might undeprecate that prop if the new alternative's issues can't be worked out.

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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants