6 / 6 · Intermediate
Screen readers and the first rule of ARIA
The first rule of ARIA is to avoid it: if a native HTML element already does the job, such as button, use that instead of adding a role to a div.
Jump to the 10 practice questionsYou will learn
- See a page as roles, names and states
- Prefer native HTML over ARIA
- Name an icon button and hide decorative icons
Before this: Form labels
1Explain
The accessibility tree
A button can be announced as a button even when its colour is not visible. A screen reader does not read pixels. The browser builds an accessibility tree from the HTML. It is a simplified copy of the page in which every element of interest has a role (button, link, heading, checkbox), a name (the text that identifies it) and sometimes a state (checked, expanded, disabled).
A round button with an X inside. Sighted users guess it closes something; a screen reader needs the role and the name to say "Close, button".
2Problem
What is read
What does a screen reader actually read?
Hint
Not the pixels.
Solution
Answer: The accessibility tree built from the HTML
Roles, names and states come from the HTML and ARIA.
3Problem
Name, role, value
Which three things does 4.1.2 ask every control to expose?
Hint
Criterion 4.1.2.
Solution
Answer: Name, role, value
Name, Role, Value, level A.
4Explore
How people listen
Users rarely listen to a page from top to bottom. Screen readers are built into the major operating systems, and free ones can also be installed. They let people pull up a list of headings, links or landmarks, jump to the next form field, or read one line at a time. That is why the earlier units matter so much: real headings, labelled fields, buttons that are buttons and alt text all feed directly into that tree. The lang attribute on the html element matters too.
Each line has a role and a name. Screen reader users jump through lists like this instead of listening from the top.
<header><nav><a href="/">Home</a> <a href="/menu">Menu</a></nav></header>
<main>
<h1>Corner Bakery</h1>
<h2>Bread</h2>
<ul><li>Sourdough</li><li>Rye</li></ul>
<button>Order</button>
</main>5Problem
Moving through a page
Screen reader users most often move through a page by
Hint
They pull up lists.
Solution
Answer: lists of headings, links and landmarks
Screen readers offer lists to jump through, which is why structure matters.
6Explain
What ARIA does
WAI-ARIA (Accessible Rich Internet Applications) is a set of attributes that change what goes into the accessibility tree. role sets the role, attributes such as aria-label set the name, and ones such as aria-checked or aria-expanded set the state. ARIA changes only what is announced. It does not make an element focusable, does not add keyboard behaviour and does not change how it looks. The W3C ARIA Authoring Practices Guide puts it in a heading: "No ARIA is better than bad ARIA".
7Problem
Does ARIA change the look?
Does ARIA change how an element looks?
Hint
Looks come from CSS.
Solution
Answer: No, only what is announced
Looks come from CSS; behaviour from HTML or scripts.
8Explore
The first rule
The W3C document Using ARIA sets out short rules that are quoted everywhere (it was marked as a discontinued draft in February 2026, but the rules themselves have not changed). Rule 1: if you can use a native HTML element or attribute with the meaning and behaviour you need already built in, do so, instead of repurposing another element with ARIA. Rule 2: do not change native semantics unless you really have to. Rule 3: every interactive ARIA control must be usable with the keyboard.
Both are announced as checkboxes, but only the real input can be reached with Tab and ticked with Space.
<span role="checkbox" aria-checked="false">Send me the weekly menu</span>
<label><input type="checkbox"> Send me the weekly menu</label>9Problem
Rule 1
What is the first rule of ARIA use?
Hint
Native elements come with keyboard support.
Solution
Answer: Use a native HTML element if it already does the job
Native elements come with role, name handling and keyboard support.
10Problem
role="button" on a span
You add role="button" to a span. What do you still have to add yourself?
Hint
ARIA changes only what is announced.
Solution
Answer: Focus and Enter/Space handling
ARIA changes the announcement only; rule 3 says it must work from the keyboard.
11Problem
Bad ARIA
Which heading appears in the W3C Authoring Practices Guide?
Hint
Wrong information is worse than none.
Solution
Answer: No ARIA is better than bad ARIA
Wrong ARIA gives false information to screen reader users.
12Explore
Where ARIA helps
Where ARIA does help is in filling gaps HTML cannot. A button that contains only an icon has no text, so it has no name; aria-label="Close" gives it one. An SVG icon next to visible text is decoration, and aria-hidden="true" on the svg keeps it out of the tree. Those are the two attributes most beginners need. For whole widgets such as tabs or menus, follow the matching pattern in the Authoring Practices Guide rather than inventing one.
An icon-only button has no name until aria-label gives it one. aria-hidden keeps a decorative icon out of the list.
<button><svg width="16" height="16" viewBox="0 0 16 16"><path d="M2 2 L14 14 M14 2 L2 14" stroke="black" stroke-width="2"/></svg></button>
<button aria-label="Close"><svg width="16" height="16" viewBox="0 0 16 16"><path d="M2 2 L14 14 M14 2 L2 14" stroke="black" stroke-width="2"/></svg></button>
<button><svg aria-hidden="true" width="16" height="16"></svg> Print</button>13Problem
Naming an icon button
Hint
aria- plus a word.
Solution
Answer: aria-label
aria-label supplies the name, for example aria-label="Close". It tells the listener what the icon-only button does, but does not add keyboard behaviour.
14Problem
Never aria-hidden here
Where must aria-hidden="true" never go?
Hint
Something you can focus but not hear.
Solution
Answer: On an element that can receive focus
Rule 4: users would focus on something the screen reader cannot describe.
15Problem
The lang attribute
What does the lang attribute on html help a screen reader do?
Hint
Voices and pronunciation.
Solution
Answer: Choose the right voice and pronunciation
The lang attribute declares the page language, as criterion 3.1.1 requires. A screen reader uses it to choose suitable pronunciation rather than guessing from the page’s appearance.
16Practice
Name the close button
The close button contains only an icon, so it has no name. Give the button aria-label="Close" and hide the decorative svg with aria-hidden="true".
- button named Close
- svg hidden
<div class="dialog">
<button class="close">
<svg width="16" height="16" viewBox="0 0 16 16"><path d="M2 2 L14 14 M14 2 L2 14" stroke="black" stroke-width="2"/></svg>
</button>
<p>Your order is ready.</p>
</div>Hint
Two attributes: aria-label on the button, aria-hidden on the svg.
A solution
<div class="dialog">
<button class="close" aria-label="Close">
<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16 16"><path d="M2 2 L14 14 M14 2 L2 14" stroke="black" stroke-width="2"/></svg>
</button>
<p>Your order is ready.</p>
</div>17Practice
A native checkbox
This checkbox is a span with ARIA and no keyboard support. Apply the first rule: replace it with <input type="checkbox" id="news"> and a label for it with the same text, and remove the span.
- a real checkbox
- label tied to it
- ARIA span removed
<form>
<span role="checkbox" aria-checked="false" onclick="this.setAttribute('aria-checked', this.getAttribute('aria-checked') === 'true' ? 'false' : 'true')">Send me the weekly menu</span>
</form>Hint
Replace the whole span with an input and a label.
A solution
<form>
<input type="checkbox" id="news">
<label for="news">Send me the weekly menu</label>
</form>18Explain
Common mistakes
<button aria-hidden="true">Order</button><button>Order</button>aria-hidden on something that can take focus leaves keyboard users on a control the screen reader cannot describe.
19
Summary
- Screen readers read the accessibility tree: role, name, state.
- ARIA changes what is announced, not behaviour or focus.
- Rule 1: use native HTML first. No ARIA is better than bad ARIA.
- aria-label names icon buttons; aria-hidden hides decoration.