ARIA Tab Pannel Example
About our product
Prices
List of prices
Features
List of product features....
Notes:
Although the code is short and simple, it is fully accessible. This example uses:
- aria-selected to show what tab is selected
- aria-controls to show the relationship between tabs and tab panels
- aria-hidden, to hide the unselected tab panel
- When an tab is selected the following states are toggled: aria-selected in both tab elements and aria-hidden on both tab panels.
- CSS selectors are used to bind aria-hidden and CSS display:none.
- CSS selectors are used to bind aria-selected and the classes for selected or non selected tab panels.
- Keyboard accessibility is given by adding the enter key to the basic click event in the jquery code.
- The tabs can also toggle using the left and right arrow keys (as a jquery function)
- Note that often only the active tab is in the tabbing order. However, in this example both tabs are always in the tabbing order. I felt this pattern worked better for this context.
Author: Lisa Seeman