8000 [data grid][dialog] The DataGrid's horizontal scroll resets to its default position automatically. · Issue #17784 · mui/mui-x · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[data grid][dialog] The DataGrid's horizontal scroll resets to its default position automatically. #17784

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

Open
ustimenko-andrew opened this issue May 10, 2025 · 2 comments
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@ustimenko-andrew
Copy link
ustimenko-andrew commented May 10, 2025

Steps to reproduce

I’m using a Dialog component together with a DataGrid. When the sort method is changed, the onSortModelChange function is triggered, followed by a re-render of the Dialog and the DataGrid. In about 50% of cases, a bug occurs: during horizontal scrolling, the table may automatically scroll back to the initial position.

Focus remains on a table cell, and it seems that autofocus is being triggered, which scrolls the view back to the column that controls sorting.

I tried using the following Dialog props:

disableAutoFocus
disableEnforceFocus
disableRestoreFocus

…but none of them helped. The only workaround that currently works for me is manually clearing the focus after changing the sort model using document.activeElement?.blur?.();

Current behavior

After changing the sorting method, horizontal scrolling in the DataGrid resets and focuses back on the sorted column automatically

Expected behavior

The horizontal scroll should not automatically return to the initial position or to the sorted column

Context

Is there any way to avoid focusing on the cell without using the workaround with document.activeElement?.blur?.()?
At the moment, it’s unclear to me whether this issue comes from the Dialog, which might be trying to scroll to the first focusable element, or from the DataGrid itself.

Your environment

npx @mui/envinfo
 "@mui/material": "^6.1.6",
 "@mui/x-data-grid-pro": "^7.21.0",

Search keywords: DataGrid, Dialog, focus, scroll

Order ID: 110382

@ustimenko-andrew ustimenko-andrew added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 10, 2025
@github-actions github-actions bot added component: data grid This is the name of the generic UI component, not the React module! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/ labels May 10, 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! status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

3 participants
@ustimenko-andrew and others
0