HTML: aria-label

The aria-label attribute gives an element a name for assistive technology when a suitable visible name is not available.

What you will learn

Icon button example

<button type="button" aria-label="Close dialog">
  &times;
</button>

A screen reader can announce the button as “Close dialog” even though the visible control only contains an icon.

Prefer visible names when possible

<button type="button">Save changes</button>

Visible text helps everyone, including people who do not use assistive technology. For form inputs, use a visible label element when possible.

Common mistakes