Bloomlight University · Accessibility

What is aria-label?

How aria-label names icon buttons and other controls for screen readers, and when plain HTML does the job better.

aria-label gives an element on your page a name that screen readers announce but nobody sees. It's the fix for icon buttons that say nothing to a screen reader, and one of the most overused attributes on the web. Here's when to reach for it, and when not to.

What it does

Every link, button and form field needs a name, the words a screen reader says when someone lands on it. Usually the name comes from what's already on the page: the text inside a button, the label beside a field, the alt text of an image in a link. When there isn't any text, aria-label supplies it:

<button aria-label="Close"><svg aria-hidden="true">…</svg></button>

Without it, a screen reader reaches that button and says only "button". With it, it says "Close, button".

aria-label is part of WAI-ARIA, a standard from the W3C for describing things to assistive technology that plain HTML can't.

When to use it

  • Icon-only buttons and links: a close ✕, a search magnifying glass, a hamburger menu, social media icons in the footer.
  • Inline SVG images: an SVG that carries meaning has no alt attribute. Give it role="img" and an aria-label instead.
  • Telling similar regions apart: a page with two navigation menus can label them "Main" and "Footer", so screen reader users can tell which one they're in.

When not to use it

The W3C's first rule of ARIA is not to use it when plain HTML does the job. Most of the time, it does.

  • On images, use alt instead. An <img> already has a way to describe itself. See What is alt text?.
  • On form fields, use a visible label. A <label> helps everyone, including people who forget what a field was for once they start typing. An aria-label only helps screen reader users.
  • Not when there's already text. aria-label replaces the text inside an element, so a screen reader announces the label and skips the text. Get them out of step and screen reader users hear something different from what everyone else sees.
  • Not on plain div and span elements. An element with no role, like a div or span, isn't allowed a name, so screen readers may ignore the label.

Make it match what people see

When a control has visible text, its name should include that text, word for word. WCAG success criterion 2.5.3 Label in Name asks for this at level A, because people who control their computer by voice say what they see. If a button reads "Send" but its aria-label says "Submit message", saying "click Send" does nothing.

Related attributes

  • aria-labelledby names an element with text that's already on the page, by pointing to that text's id. Prefer it to aria-label when the words are visible somewhere, like a heading above a section.
  • aria-describedby adds extra information after the name, like the hint under a password field.
  • aria-hidden="true" hides an element from screen readers entirely. Use it on decorative icons inside a button that already has a name, so they aren't read out twice.

How Bloomlight helps

Bloomlight's accessibility audit flags buttons, links and form fields on your key pages that have no name a screen reader can announce. Each one becomes a finding that shows you where it is on the page, so you can add the visible text, label or aria-label it needs.

Start watching your site — free, today.

Two minutes to add your domain. First report in your inbox within the hour.