Which of the examples below have descriptive accessible names?
In this example, the button has no accessible name. Screen reader users will hear it announced only as a button
, with no indication of what it does.
<button>
<img src="down.png" alt="">
</button>
In this example, the content of the <a> element provides its accessible name.
More
More
<a href="#">More</a>
In this example, the content of the <button> element provides its accessible name.
Close
Close
<button>Close</button>
aria-labelIn this example, aria-label provides a more descriptive accessible name than the visible link text.
More
More about wombats
<a href="#" aria-label="More about wombats">
More
</a>
aria-labelIn this example, the button contains only an icon, so aria-label provides its accessible name.
Expand accordion
<button aria-label="Expand accordion">
<img src="down.png" alt="">
</button>
<input> without an accessible nameIn this example, the <input> has no accessible name. Screen reader users will hear it announced only as a form field, with no indication of its purpose.
Address
<label>Address</label>
<input type="text">
<input> with programmatically associated <label>In this example, the content of the <label> element provides the accessible name for the <input>. This works because the for and id attributes programmatically associate the label with the input.
Address
Address
<label for="address">Address</label>
<input id="address" type="text">