-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Library: revisit keyboard navigation for pattern items #52009
Copy link
Copy link
Closed
Labels
Needs Accessibility FeedbackNeed input from accessibilityNeed input from accessibility[Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsyncedA collection of blocks that can be synced (previously reusable blocks) or unsynced[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).
Metadata
Metadata
Assignees
Labels
Needs Accessibility FeedbackNeed input from accessibilityNeed input from accessibility[Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsyncedA collection of blocks that can be synced (previously reusable blocks) or unsynced[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
The template part and pattern listings in the Library are implemented using
CompositeandCompositeItemcomponents. 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