ARIA
Last updated: 16 December 2024
On this page:
5 rules of ARIA
- First Rule of ARIA: Don't use ARIA if a native HTML element or attribute exist.
- Second Rule of ARIA: Do not change native semantics, unless you really have to.
- Third Rule of ARIA: All interactive ARIA controls must be usable with the keyboard.
- Fourth Rule of ARIA: Do not use role=”presentation” or aria-hidden=”true” on a focusable element:
- Fifth Rule of ARIA: All interactive elements must have an accessible name.
Commonly used ARIA attributes
role | parent | child | attributes | accessible name | html equivalent | note |
---|---|---|---|---|---|---|
list | listitem | [aria-labelledby] [aria-label] |
ul | Not so short note on aria-label usage Accessibility! aria-label vs. title attribute |
||
listitem | list | |||||
img | [aria-labelledby] [aria-label] |
required | img | alt ONLY works on img-elements, alt on role="img" is inadequate; Alt Left | ||
figure | [aria-labelledby] [aria-describedby] [aria-label] |
figure | ||||
banner | [aria-labelledby] [aria-label] |
navigational landmark, use only once | ||||
search | [aria-labelledby] [aria-label] |
|||||
checkbox | aria-checked [aria-labelledby] [aria-label] [aria-disabled] [aria-haspopup] [aria-describedby] [aria-expanded] |
required | input type="checkbox" | |||
radiogroup | radio | [aria-labelledby] [aria-label] [aria-activedescendant] [aria-disabled] [aria-owns] [aria-required] [aria-haspopup] [aria-describedby] |
||||
radio | radiogroup | aria-checked [aria-labelledby] [aria-label] [aria-posinset] [aria-setsize] [aria-disabled] [aria-haspopup] [aria-describedby] |
||||
table | [rowgroup] [row] |
table | ||||
rowgroup | row | thead, tbody, tfoot | ||||
row | cell | tr | ||||
columnheader | th scope="col" | |||||
rowheader | th scope="row" | |||||
cell | td | |||||
presentation | ||||||
alertdialog | (aria-labelledby | aria-label) aria-describedby aria-modal |
|||||
dialog | (aria-labelledby | aria-label) aria-describedby aria-modal |
|||||
alert | [aria-live] [aria-atomic] [aria-relevant] |
aria-live="assertive" aria-atomic="true" aria-relevant="additions text" | ||||
log | [aria-labelledby] [aria-label] [aria-live] [aria-atomic] [aria-relevant] |
aria-live="polite" aria-atomic="false" aria-relevant="additions text" |
||||
status | [aria-labelledby] [aria-label] [aria-live] [aria-atomic] [aria-relevant] |
aria-live="polite" aria-atomic="false" aria-relevant="additions text" |
||||
timer | [aria-labelledby] [aria-label] [aria-live] [aria-atomic] [aria-relevant] |
aria-live="off" aria-atomic="false" aria-relevant="additions text" | ||||
button | [aria-labelledby] [aria-label] [aria-describedby] [aria-pressed] [aria-disabled] [aria-haspopup] [aria-expanded] |
required | button | |||
link | [aria-labelledby] [aria-label] [aria-describedby] [aria-disabled] [aria-haspopup] [aria-expanded] |
required | a | |||
tablist | tab | [aria-labelledby] [aria-label] [aria-describedby] [aria-activedescendant] see [aria-disabled] [aria-multiselectable] [aria-owns] [aria-level] [aria-orientation] [aria-haspopup] |
||||
tab | aria-selected
[aria-labelledby] [aria-label] [aria-expanded] [aria-posinset] [aria-setsize] [aria-disabled] [aria-haspopup] [aria-describedby] |
required | roving tabindex | |||
tabpanel | [aria-labelledby] [aria-label] [aria-hidden] |
associated with tab |
Can I use this ARIA attribute?
(this is work in progress)
ARIA on SVG
Some examples to use aria to a minimum on SVG.
<svg role="img" aria-labelledby="tid">
<title id="tid">Relevant text</title>
<use xlink:href="#icon"></use>
</svg>
<a href="link" aria-label="Clear linkname">
<svg>
<use xlink:href="#icon"></use>
</svg>
</a>
<a href="link">
<svg>
<use xlink:href="#icon"></use>
</svg>
Twitter
</a>
<a href="#messages">
<span id="numberOfMessages">0</span>
<span class="visually-hidden"> messages</span>
<svg aria-hidden="true">
<use xlink:href="#icon-mailbox"></use>
</svg>
</a>
Sources: WAI-ARIA 1.1.
Updates
- 24-10-2023 alt does not work with non-img-elements even if role="img" is used.