docs.rodeo

MDN Web Docs mirror

ARIA: tablist role

{{AccessibilitySidebar}} 

The tablist role identifies the element that serves as the container for a set of tabs. The tab content are referred to as tabpanel elements.

Description

You may be interacting with a tabbed interface as you read this! Browser tabs allow a user have multiple web pages open in a single window. Clicking on a tab in the tablist at the top of the browser window enables the user to display the associated content in the main content area, the tabpanel, one site at a time. This is called a “tab design pattern”.

When implementing a tab design pattern, the tab, tablist and tabpanel roles are used.

Tabs are a set of layered sections of content, known as tab panels, that display one panel of content at a time. Each tab panel has an associated tab element, that, when activated, displays the panel. The list of tab elements is arranged along one edge of the currently displayed panel, most commonly the top edge, nested in a tablist element.

Each tab in a tablist serves as a label for one tabpanel and can be activated to display that panel. The tablist is the containing element for the set of tab elements contained.

When a tabbed interface is initialized, one tab panel is displayed and its associated tab is styled to indicate that it is active. When the user activates one of the other tab elements, the previously displayed tab panel is hidden, the tab panel associated with the activated tab becomes visible, and the tab is considered “active”.

For a single-selectable tablist, the non-active tabpanel elements should be hidden from the user until the user selects the tab associated with that tabpanel.

When creating a multi-selectable tablist, include aria-multiselectable="true" on the tablist element.

The tab elements not the tablist, have the aria-selected attribute. Set to aria-selected="true" for the tabs associated with each visible tabpanel. The tabs associated with hidden tabpanel elements have their aria-selected attributes set to false.

If the tab list has a visible label, set aria-labelledby to the id of the labelling element. If not, use aria-label to provide a label.

To be keyboard accessible, focus must be managed for the descendants of this role.

Elements with the tablist role have an implicit aria-orientation value of horizontal.

Associated WAI-ARIA roles, states, and properties

Keyboard interactions

For the tab list:

When focus is on a tab element in a horizontal tab list:

When focus is on a tab element in a vertical tab list:

If the tab list is horizontal, it does not listen for Down Arrow or Up Arrow so those keys can provide their normal browser scrolling functions even when focus is inside the tab list.

When focus is on a tab in a tablist with either horizontal or vertical orientation:

Examples

See the tabpanel, tab, and tablist example in the tab role definition.

Specifications

{{Specifications}} 

See also

In this article

View on MDN