Accordion
Keyboard Expectations
- Enter or Space = Expands/Collapses Panel
- Tab = Move to next focusable element
- Shift + Tab = Move to previous focusable element
- ↑ ↓ = Cycle headers when header focused
- Home (Optional) = Focus first header
- End (Optional) = Focus last header
Focus Expectations
- Headers should have visible keyboard focus state
- All keyboard interactions relate to when headers are focused
Labelling Expectations
- Each accordion header title is contained in an element with role button (e.g.
<button>
). - Each accordion header button wrapped with role heading set to appropriate aria-level.
- HTML
heading
elements can be used. - Only one
button
element is allowed in theheading
. Other visual elements must be outside theheading
element.
- HTML
- If the accordion panel is visible, the header button element should have aria-expanded set to true. If the panel is not visible,
aria-expanded
is set to false. - Accordion header buttons have aria-controls set to the ID of the associated accordion panel content.
Disclosure (Show/Hide)
Keyboard Expectations
- Enter or Space = Toggle content
Focus Expectations
- Trigger has visible keyboard
:focus
state
Labelling Expectations
- Trigger has role of button (e.g.
<button>
) - When content is visible,
button
has aria-expanded set totrue
. When content is hidden, it is set tofalse
. - (Optional)
button
references content with aria-controls
Tabs
Keyboard Expectations
- Space or Enter = Activate Tab
- ←→ = Cycles tab focus
- ↑↓ = Cycles tab focus (vertical tabs)
- Home = Focus first tab
- End = Focus last tab
Focus Expectations
- Tabs should activate automatically when receiving focus as long as associated tab panels are rendered quickly.
- Tabs should have visible
:focus
state. - Tabs should have visible
aria-selected="true"
state
Labelling Expectations
- The element that wraps tabs has role tablist.
- Each tab has role tab and is contained within the element with role
tablist
. - Each tab content panel has role tabpanel.
- Each
tab
has the property aria-controls referring to itstabpanel
. - The active
tab
has aria-selected set totrue
and all othertab
elements have it set tofalse
. - Each
tabpanel
has the property aria-labelledby referring to its associatedtab
.
Tooltip
Keyboard Expectations
- ESC = Dismisses tooltip
Focus Expectations
- Focus stays on tooltip trigger while the tooltip is displayed.
- If the tooltip is invoked when the trigger receives focus, then it is dismissed when it no longer has focus (onBlur). If the tooltip is invoked with mouseIn, then it is dismissed with on mouseOut.
Labelling Expectations
- Tooltip content container has role
tooltip
- Tooltip trigger references the tooltip element with
aria-describedby