List view: focus management conflicts between focus on mount, TreeGrid roving tabindex, and keyboard shortcut focus #69147
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Block editor
/packages/block-editor
[Package] Editor
/packages/editor
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
The List View focus management expected behavior is made of three parts:
Overall, the list view should have only one focusable item at a time. For example. the logic of the keyboard shortcut focus management expects only one focusable item, that is an item with
tabindex=0
. All the other ones should havetabindex=-1
However, there are cases where the list view contains two focusable items. This is not expected and makes the expectations described above fail.
There's several user flows where this may occur, I'm going to detail only some of them.
1
No blocks selected.
Open the list view. Initial focus is on the first item. So far so good.
2
Top level block selected.
Open the list view. Initial focus is on the selected item in the list view. So far so good.
The selected item is highlighted and focused.
3
Nested block selected.
Open the list view. Initial focus is on the first item.
The item of the selected block is highlighted but not focused.
Expected: to be highlighted and focused.
4
Using the keyboard shortcut from a selected block with the list view already open.
Start with no block selected.
Open the list view. Initial focus is on the first item.
Click on a paragraph to select it.
Use the keyboard shortcut (alt+shift+o on Windows, and control+option+o on Mac)
Focus is on the first item.
The item of the selected block is highlighted but not focused.
Expected: to be highlighted and focused.
Animated GIF to illustrate:
There are other flows to test in depth, I'll reserve to details them later if necessary. To mention a few of them:
When a post is empty and there are no blocks yet
handleSidebarFocus
.With 'Always open List View' preference enabled
When the panel is open but the selected tab is the Outline one.
To be tested.
With multiple blocks selected
To be tested.
Step-by-step reproduction instructions
See above
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: