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] Row auto height scroll glitch #14726

Open
boldurean opened this issue Sep 25, 2024 · 4 comments · May be fixed by #16763
Open

[data grid] Row auto height scroll glitch #14726

boldurean opened this issue Sep 25, 2024 · 4 comments · May be fixed by #16763
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Row height Related to the data grid Row height features regression A bug, but worse support: commercial Support request from paid users support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@boldurean
Copy link

boldurean commented Sep 25, 2024

The problem in depth

Hi. We've noticed a problem with DataGrid scroll when using dynamic row height.
We thought it's our grid setup but we noticed same behaviour on the docs page as well as in your sandbox example
please see the videos below:

Screen.Recording.2024-09-25.at.09.52.37.mp4
Screen.Recording.2024-09-25.at.10.07.56.mov

It looks like it's happening not only when cell is selected, it happens in the sandbox when scrolling until end of the grid.
We have a dynamic row height with specific actions in each grid. It looks like this bugs affecting the users and they're unable to complete their actions as grid scroll randomly changes position. This happens in all browsers provided in the envinfo.

Your environment

`npx @mui/envinfo`
  System:
    OS: macOS 14.7
  Binaries:
    Node: 20.12.0 - ~/.nvm/versions/node/v20.12.0/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.0/bin/npm
    pnpm: 9.10.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: Version 129.0.6668.59 (Official Build) (arm64)
    Edge: 129.0.2792.52
    Safari: 18.0
  npmPackages:
    @emotion/react: ^11.13.3 => 11.13.3 
    @emotion/styled: ^11.13.0 => 11.13.0 
    @mui/icons-material: ^6.1.1 => 6.1.1 
    @mui/lab: 6.0.0-beta.10 => 6.0.0-beta.10 
    @mui/material: ^6.1.1 => 6.1.1 
    @mui/x-data-grid-premium: 7.18.0 => 7.18.0 
    @mui/x-date-pickers: ^7.18.0 => 7.18.0 
    @mui/x-tree-view: ^7.18.0 => 7.18.0 
    react: ^18.3.1 => 18.3.1 
    react-dom: ^18.3.1 => 18.3.1 

Search keywords: rowAutoHeight, rowHeight, getRowHeight, row height scroll glitch
Order ID: 85137

@boldurean boldurean added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Sep 25, 2024
@boldurean boldurean changed the title [question] DataGrid row auto height scroll glitch [bug] DataGrid row auto height scroll glitch Sep 25, 2024
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Sep 25, 2024
@boldurean
Copy link
Author

Just fyi changed version to ^6.x.x in the codesandbox example and seems this doesn't happen.

@MBilalShafi MBilalShafi added bug 🐛 Something doesn't work feature: Row height Related to the data grid Row height features regression A bug, but worse and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 27, 2024
@MBilalShafi
Copy link
Member

MBilalShafi commented Sep 27, 2024

Thank you @boldurean for reporting, I can reproduce the bug, it seems that the virtual scroller is miscomputing the render zone through the end when a cell is focused. And yes it isn't there in v6 which makes it a regression.

@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Sep 27, 2024
@boldurean
Copy link
Author

@MBilalShafi thanks for response.
It looks like it happens as well when cell is not selected. Some cells could render images and be auto-sized based on the img height, not selecting the row in this case will cause same issue.

@KenanYusuf KenanYusuf changed the title [bug] DataGrid row auto height scroll glitch [data grid] Row auto height scroll glitch Oct 10, 2024
@cherniavskii cherniavskii removed the bug 🐛 Something doesn't work label Oct 10, 2024
@steviesocks
Copy link

steviesocks commented Feb 26, 2025

We're seeing this same issue in our project (with Data Grid Pro). Scrolling a selected row (or the last selected row if multiple rows are selected) out of view causes a scrolling "jump." You can also repro this in the Row Selection docs: https://mui.com/x/react-data-grid/row-selection/#multiple-row-selection

Make a couple changes to the demo code (see comments):

import * as React from 'react';
import { DataGridPro } from '@mui/x-data-grid-pro';
import { useDemoData } from '@mui/x-data-grid-generator';

export default function MultipleRowSelectionGrid() {
  const { data, loading } = useDemoData({
    dataSet: 'Commodity',
    rowLength: 100,
    maxColumns: 6,
  });

  return (
    <div style={{ height: 400, width: '100%' }}>
      <DataGridPro
        {...data}
        getRowHeight={() => 'auto'} // ADD THIS PROP
        loading={loading}
        pagination
        initialState={{
          ...data.initialState,
          pagination: {
            paginationModel: {
              pageSize: 20, // INCREASE PAGE SIZE TO ALLOW ROOM FOR SCROLLING OUT OF VIEW
            },
          },
        }}
      />
    </div>
  );
}

Then select one or more rows and scroll till the bottom-most selected row is out of view. You should see the jump.

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Feb 26, 2025
@michelengelen michelengelen added the support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/ label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Row height Related to the data grid Row height features regression A bug, but worse support: commercial Support request from paid users support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants