Remove extraneous elements placed between Tabs and Tab panels #59013
Description
Description
Splitting this out from #58942
Recent work improved the consistency of various tabbed interfaces in the editor by using the Tabs component. That's a very welcomed improvement.
However, in a few places the Tabs component is used incorrectly. The whole purpose of a tabbed interface is to allow keyboard users to save tab key presses and be able to tab directly from a selected tab to its associated tab panel.
Image courtesy of Heydon Pickering, from his accessible components, to visually illustrate the expected keyboard interaction:
Placing extraneous focusable elements between the tabs and the tab panels defeats the purpose of a tabbed interface.
There's a few places in the editor where a 'Close' button is placed in the between and adds an unexpected tab stop between the tabs and the tab panels. For example, in all the Settings panels:
And #58942 would reproduce the same problem in the List View panel.
There's two requirements to follow:
- There must be no focusable or otherwise interactive elements between Tabs and Tab panels.
- The visual order must match the DOM order.
As such, the only solution to this is to remove the Close button from that spot and place it somewhere else.
It would be great to have the Tabs component to enforce this via code: no extraneous element can be placed between Tabs and Tab panels.
Step-by-step reproduction instructions
- Go to the Post editor > Settings panel.
- Use a keyboard.
- Tab to the first tab.
- Use the right or left arrow keys to select a tab.
- Optionally activaate on of the tabs by pressing Enter or Space bar.
- Press the tab key again.
- Expected: focus to go to the Tab panel (either the tab panel itself or the first focusable element within it, depending on the configuration).
- Actual: focus moves to the Close button.
Screenshots, screen recording, code snippet
No response
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