-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Library: revisit keyboard navigation for pattern items #52009
Comments
I think my preferred pragmatic option would be replacing the 'delete' shortcut with a single keyboard shortcut for opening the actions menu (I'm not sure what the best shortcut key would be. Possibly the 'A' key). Maybe the simplest implementation is trigger a 'click' event on the dropdown menu button, as I don't think there's a 'controlled' way to open a |
@alexstine @joedolson @afercia could you all perhaps provide feedback here? |
The problem is, discoverability. Why not implement |
@alexstine The items aren't a tree, but a normal linear list. I guess that would be a grid pattern? For keyboard navigation it would probably be very similar to List View, just without the depth/nesting aspect. |
@talldan I was just thinking, that same keyboard experience, that would work perfectly for this the way you describe it. |
I noticed this in another issue and commented:
Also, in ARIA a listbox is something pretty different and it's more something close to a select with multiple selection, see https://www.w3.org/WAI/ARIA/apg/patterns/listbox/ I'd strive for simplicity and also avoid a treegrid or a grid. Why not use a simple list, where each item has a button that shows the available actions? |
I think the main issues outlined here have been resolved by the move to a simple ul so closing this for now. |
Description
The template part and pattern listings in the Library are implemented using
Composite
andCompositeItem
components. The way this works is that the entire list is a single tab stop. Up and down arrow keys are used to navigate. The list implements a roving tab index, so when tabbing out of the list and back in again, the previously focused item (not the first focusable item) will be focused.The problem is that each pattern item in the Custom Patterns category also has an 'Actions' dropdown menu, which is another tab stop within the list. That interferes with the way keyboard navigation is supposed to work—the roving tab index wouldn't be restored correctly, and it would be extremely challenging to interact with the dropdown.
A quick fix was applied when shipping the original library PR:
This approach isn't particularly scalable. As more actions are added to the dropdown, more shortcuts also need to be added to cover each of the actions. Users also need to be made aware of what the special shortcuts are.
Some possible options (pick one):
It'd be great to hear any other ideas.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: