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

Additional keyboard navigation scenario #651

Open
ryanmearns opened this issue May 1, 2022 · 1 comment
Open

Additional keyboard navigation scenario #651

ryanmearns opened this issue May 1, 2022 · 1 comment
Labels
Example A good example of a certain scenario

Comments

@ryanmearns
Copy link

I was having a play around with your keyboard navigation, and I want to suggest an improvement.

Problem: When a user uses the keyboard to navigate the list, the list item should be in focus.

Solution: Create a roving focus prop using the index and the current item index in a separate inner item.

Here is the code based on the original keyboard navigation to do it: https://codesandbox.io/s/react-virtuoso-focused-item-jv35gp?file=/App.js

I'm happy to make a PR if this is of interest.

@petyosi petyosi added the Example A good example of a certain scenario label May 3, 2022
@petyosi
Copy link
Owner

petyosi commented May 3, 2022

That's a good example, thank you very much for sharing it. I am not sure if mousemove should trigger a re-focus (a click should, obviously). I'm also not entirely sure if using the native focus is the way to go, as it might interfere with the browser tabbing. Imagine a list of 1000 items - a keyboard-exclusive user would get "stuck" in the list.

I wish I had more time to spend on the details of accessible lists :(.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Example A good example of a certain scenario
Projects
None yet
Development

No branches or pull requests

2 participants