ARIA roles
Landmark and component roles, ARIA properties and states (aria-label, aria-labelledby, aria-expanded, aria-hidden, aria-live), accessible name, and the first rule: a native element before ARIA.
- 24 cards
- 3 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
A few cards from the deck
ARIA role: what is it?
Show the answer
The
roleattribute, which tells assistive technologies what an element is (button, tab, navigation, alert) when HTML alone does not.A role changes neither looks nor behaviour:
role="button"on adivannounces it as a button, but makes it neither focusable nor keyboard-activatable.What accessible name does a screen reader give this button?
```html
<span id="titre">Supprimer le compte</span>
<button aria-label="Corbeille" aria-labelledby="titre">
🗑
</button>`- Delete account
- Trash
- 🗑
- Trash Delete account
Show the answer
Delete account
aria-labelledbycomes beforearia-labelin the name computation, andaria-labelbefore the content. The name is therefore the text of the#titreelement.The first rule of ARIA: if a … HTML element already does the job, use it rather than adding an ….
Show the answer
The first rule of ARIA: if a native HTML element already does the job, use it rather than adding an ARIA role.
<button>brings the role, focus and Enter and Space activation by itself;<div role="button">forces you to code it all by hand.Accessible name: what is it?
Show the answer
The text by which an assistive technology refers to an element, computed from its label, its content or its attributes.
It is computed in this order:
aria-labelledby, thenaria-label, then the native content or label (label,alt, text), thentitle. A button with no name is announced as just "button".What is wrong with this code from a keyboard and screen reader viewpoint?
```html
<a href="/panier" aria-hidden="true">Panier</a>`- The link is no longer displayed on screen
- The link stays focusable but goes silent for the screen reader
- The link is no longer focusable by keyboard
- The link is announced as a button
Show the answer
The link stays focusable but goes silent for the screen reader
aria-hiddenonly acts on the accessibility tree: display and focus do not change. Tab then stops on an element the screen reader does not describe. To hide for everyone, usehiddenordisplay: none.