Skip to content

Remove extraneous elements placed between Tabs and Tab panels #59013

Open
@afercia

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:

tabs 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:

Screenshot 2024-02-14 at 12 50 28

Screenshot 2024-02-14 at 12 50 51

Screenshot 2024-02-14 at 13 52 31

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

Metadata

Assignees

No one assigned

    Labels

    Needs DesignNeeds design efforts.[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components[Package] Edit Post/packages/edit-post[Package] Edit Site/packages/edit-site[Package] Edit Widgets/packages/edit-widgets[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions