html · level 2 · unit 6 · lesson 2
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
aria-label names a part that has no useful words.
Screen readers say an for every link, button and box. Usually it comes from the words inside, the alt text or the <label>. A button that only shows × has no useful name.
attributes start with aria- and tell screen readers more. aria-label="Close" gives that button the name Close. The words never show on the screen.
It also tells two landmarks of the same kind apart. A page with two <nav> menus can name them aria-label="Main" and aria-label="Footer".
<header>
<nav aria-label="Main">
<a href="https://example.com/">Home</a>
</nav>
<button aria-label="Close">×</button>
</header>
<footer>
<nav aria-label="Footer">
<a href="https://example.com/help">Help</a>
</nav>
</footer> Press show my page to see it here.
Visible words always beat ARIA. Only reach for aria-label when there are no words to use.
guess first
What does this button show on the page?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<button aria-label="Add to basket">+</button>
your turn
Your turn. Name the two menus.
This page has two <nav> menus. Name the top one Main, and give the bottom one a name that says where it is, such as Footer.
Press show my page to see it here.
- the top menu is called mainnot checked yet
- the bottom menu has a namenot checked yet
fix it
A screen reader only says button. Can you fix it?
Press show my page to see it here.
- the button is named closenot checked yet
- The button looks fine, but it has no name. Check the attribute's spelling.
- Attribute names must be spelt exactly. Compare it with
aria-label. - Change
aria-labletoaria-label, then press run.
nailed it
every button has a name now. :D
- Screen readers say an accessible name for each part.
aria-labelnames a part that has no words.- Use it to tell two
<nav>menus apart.
new words in your collection
- accessible name
- ARIA
This lesson isn’t saved. A free account remembers every lesson you finish.