State that ARIA has to be told in HTML
When a control changes something else on the page, the relationship has to be spelled out.
<button type="button" aria-expanded="false" aria-controls="filters">
Filters
</button>
<div id="filters" hidden>
<p>Nothing here yet.</p>
</div>
<button type="button" aria-pressed="true">Bold</button>
<nav aria-label="Primary">
<a href="/tours" aria-current="page">Tours</a>
<a href="/profile">Profile</a>
</nav>
How it works
aria-expandedsays whether the thing this control opens is open.aria-controlsnames the element it opens, by id.aria-pressedis for a toggle that stays down;aria-currentmarks where you are.
The run, in numbers
- Lines
- 13
- Characters to type
- 314
- Tokens
- 85
- Three-star pace
- 75 tpm
At the three-star pace of 75 tokens a minute, this run takes about 68 seconds.
Step 3 of 4 in Names and state, step 7 of 15 in Accessible HTML.