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] Keyboard arrow doesn't scroll #4282

Open
2 tasks done
oliviertassinari opened this issue Mar 26, 2022 · 0 comments
Open
2 tasks done

[data grid] Keyboard arrow doesn't scroll #4282

oliviertassinari opened this issue Mar 26, 2022 · 0 comments
Labels
accessibility a11y bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! regression A bug, but worse

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 26, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When using the Arrow keys, the new active cell is not visible

actual

https://master--material-ui-x.netlify.app/components/data-grid/#commercial-version

Expected behavior 🤔

When using the Arrow keys, the new active cell should be visible (scroll if necessary).

expected

http://0.0.0.0:3001/components/data-grid/#commercial-version

with

diff --git a/packages/grid/x-data-grid/src/components/cell/GridCell.tsx b/packages/grid/x-data-grid/src/components/cell/GridCell.tsx
index 710c9577..bc983146 100644
--- a/packages/grid/x-data-grid/src/components/cell/GridCell.tsx
+++ b/packages/grid/x-data-grid/src/components/cell/GridCell.tsx
@@ -172,7 +172,7 @@ function GridCell(props: GridCellProps) {
       const elementToFocus = focusableElement || cellRef.current;

       if (doesSupportPreventScroll()) {
-        elementToFocus.focus({ preventScroll: true });
+        elementToFocus.focus();
       } else {
         const scrollPosition = apiRef.current.getScrollPosition();
         elementToFocus.focus();

We can also see it behave correctly on the first demo of https://www.ag-grid.com/.

Steps to reproduce 🕹

Steps:

  1. Open https://master--material-ui-x.netlify.app/components/data-grid/#commercial-version
  2. Follow the previous videos

Context 🔦

It's a regression introduced in #2999 with the objective to fix #2508. I have found this by looking into #4280 in more detail. cc @m4theushw

I have tested it again #2508 (comment). It seems that the root problem in #2508 was solved closer to the root later on (I suspect in #3718). Therefore we could revert #2999 to fix this GitHub issue with no downsides.

Your environment 🌎

MUI X v5.7.0.

Order ID 💳 (optional)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! regression A bug, but worse
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

2 participants