Skip to content

Tabs: Missing accessibility features #22

Closed
@omaxel

Description

@omaxel

Comparing the current implementation of Tabs to the one described on this MDN page, there are a couple of issues related to accessibility.

Things we are missing are:

  • Elements with the role tab must either be a child of an element with the tablist role, or have their id part of the aria-owns property of a tablist.
  • They should contain the aria-controls property identifying an element with the tabpanel role.
  • When working with elements with the tab role, when they are selected or active, they should have their aria-selected attribute set to true, otherwise it should be set to false.
  • When a tab is selected or active, its controlled tabpanel should have its aria-expanded attribute set to true and its hidden attribute set to false, otherwise the reverse.
  • It is recommended to use a button element with the role tab for their built-in functional and accessible features instead, as opposed to needing to add them yourself. For controlling tab key functionality for elements with the role tab, it is recommended to set all non-active elements to tabindex=-1, and to set the active element to tabindex=0.

Also, I would highlight this sentence on the same MDN page:

While there are ways to build tab-like functionality without JavaScript, there are no substitute combination of HTML and CSS only that will provide the same set of functionality that's required above for accessible tabs with content.

We should decide how to approach this.

I was thinking to provide a separate package containing JS file for each component which provides accessibility improvements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions