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 navigation doesn't work when active cell is out of the viewport #5750

Closed
2 tasks done
shelimov opened this issue Aug 10, 2022 · 4 comments · Fixed by #7357
Closed
2 tasks done
Assignees
Labels
accessibility a11y bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!

Comments

@shelimov
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Whenever I press any of the arrow keys, it applies scroll to the window.
https://codesandbox.io/s/1cm3xe?file=/demo.tsx

Screen.Recording.2022-08-10.at.17.22.26.mov

Expected behavior 🤔

DataGrid should select the next cell and scroll it into view.
The same way it works in ag-grid.

Screen.Recording.2022-08-10.at.17.27.51.mov

Steps to reproduce 🕹

No response

Context 🔦

No response

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Order ID 💳 (optional)

No response

@shelimov shelimov added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 10, 2022
@DanailH
Copy link
Member

DanailH commented Aug 11, 2022

Hi, @shelimov thanks for raising this!
It is easily reproducible. It seems to be related to the focus, I think. @m4theushw I remember we discussed it some time ago but I'm unsure if it is the same problem or not.

@DanailH DanailH changed the title [DataGrid] Keyboard navigation doesn't work when active cell is out of the viewport [data grid] Keyboard navigation doesn't work when active cell is out of the viewport Aug 11, 2022
@DanailH DanailH added bug 🐛 Something doesn't work accessibility a11y component: data grid This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 11, 2022
@m4theushw
Copy link
Member

We need to keep the focused cell in the viewport. With virtualization enabled, it's removed as you scroll. I'm working on a POC to fix this and also #4744. For now, if you're using a small dataset, you can disable the virtualization with disableVirtualization and it will work correctly.

@m4theushw m4theushw self-assigned this Aug 12, 2022
@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 17, 2022

I would expect #4282, #4749, and #2508 to be linked to this problem. The symptoms feel the same, involving the focus and out-of-viewport cells.

@bjornarvh
Copy link

bjornarvh commented Oct 3, 2022

Keeping focused cell in DOM might not be enough. This also happens for us when the data changes so that the focused record is no longer in the data. For example if the page changes with pagination enabled. The grid is not accessible by keyboard at all when it happens, as there are no tab stops in it.

This can easlily be reproduced in the pagination examples in your documentation. Focus a cell, change page, and try to focus the grid again with keyboard.

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