Example
Aria
Role, Property, State, and Tabindex Attributes
Role | Attribute | Element | Usage |
---|---|---|---|
tablist
|
div
|
Indicates that the element serves as a container for a set of tabs. | |
aria-label=
|
div
|
Provides a label that describes the purpose of the set of tabs. | |
tab
|
button
|
|
|
aria-selected=
|
button
|
|
|
aria-selected=
|
button
|
|
|
tabindex=
|
button
|
|
|
aria-controls=
|
button
|
Refers to the tabpanel element associated with the tab.
|
|
tabpanel
|
div
|
|
|
aria-labelledby=
|
div
|
|
|
tabindex=
|
div
|
|
Keyboard Shortcuts
If you focus on the tabs “buttons”:
- use Up/Left to see previous tab,
- use Down/Right to see next tab
- use Home to see first tab (wherever you are in tab buttons)
- use End to see last tab (wherever you are in tab buttons)
If you focus on a tab content:
- use Ctrl Up/Left to set focus on the tab button for the currently displayed tab
- use Ctrl PageUp to set focus on the previous tab button for the currently displayed tab
- use Ctrl PageDown to set focus on the next tab button for the currently displayed tab
Warning: Ctrl+PageUp/PageDown combination could activate for some browsers a switch of browser tabs. Nothing to do for this, as far as I know (if you have a solution, let me know).
