aria-label is a WAI-ARIA attribute that assigns an element an accessible name in the form of a plain text string, which assistive technologies such as screen readers announce instead of, or in the absence of, visible text. In web accessibility, it is used mainly for interactive controls that have no visible text label, such as icon-only buttons, close controls and search fields marked only by a magnifying glass.
The attribute changes only what the accessibility tree exposes, not what sighted users see or how the element behaves. That makes it powerful and risky at the same time: a correct value can rescue an unlabeled control, while a wrong or unnecessary value can hide the visible text from screen reader users or create a mismatch with voice control commands.
How aria-label sets the accessible name
The browser computes an accessible name for each element using the Accessible Name and Description Computation specification, and aria-label sits high in its order of precedence. Only aria-labelledby outranks it; when aria-label is present and valid, it overrides native sources such as element content, the label element or the title attribute.
| Priority | Source | Typical use |
|---|---|---|
| 1 | aria-labelledby | Points to visible text elsewhere on the page |
| 2 | aria-label | Supplies a string when no visible label exists |
| 3 | Native labeling | Label element, alt text, legend, caption |
| 4 | Element content | Text inside buttons, links and headings |
| 5 | title or placeholder | Last-resort fallback, unreliable |
Because of this precedence, writing aria-label="Menu" on a button whose visible text reads “Open navigation” means a screen reader announces only “Menu”. The visible text is silently replaced, which is why the attribute should be added only when a better source is missing.
The value is exposed through platform accessibility APIs such as UI Automation, AT-SPI and the macOS accessibility protocol. A screen reader typically reads the name together with the ARIA role and state, for example “Close, button” or “Search, edit text”.
Where aria-label works and where it does not
aria-label is reliable only on elements that support naming from the author, which means interactive elements and landmarks. On generic elements without a meaningful role, browsers and screen readers often ignore the value, and the ARIA specification prohibits naming certain roles.
| Element or role | Effect of aria-label | Recommendation |
|---|---|---|
| Button, link, input | Reliably sets the accessible name | Use when no visible text exists |
| Landmarks such as nav | Distinguishes repeated regions | Use, for example “Primary” and “Footer” |
| Dialog or region | Names the container | Prefer aria-labelledby to the visible heading |
| Plain div or span | Often ignored, naming prohibited | Add a proper role or use visible text |
| Paragraph or generic text | Prohibited for these roles | Do not use |
Landmark labels deserve special care. When a page has two navigation landmarks, labels such as “Primary” and “Breadcrumb” let screen reader users tell them apart in a landmarks list. The word “navigation” should not be repeated in the label, because the role is already announced.
aria-label compared with other labeling techniques
aria-label is one of several ways to name an element, and it is usually not the first choice. The guiding principle known as the first rule of ARIA says to use a native HTML element or attribute with the needed semantics whenever possible.
| Technique | Visible to sighted users | Main advantage | Main drawback |
|---|---|---|---|
| Label element | Yes | Native, clickable, robust | Only for form controls |
| aria-labelledby | Yes | Reuses existing visible text | Requires stable element IDs |
| aria-label | No | Quick fix for icon controls | Not translated, easy to forget |
| Visually hidden text | No | Translated with the page | Requires a utility CSS class |
| alt attribute | Only when image fails | Native for images | Only for images |
A notable weakness is localization. Many automatic translation tools translate visible text but skip attribute values, so an English aria-label may remain in a page translated into another language. Visually hidden text inside the element avoids this problem and is often preferred for multilingual sites.
aria-label should also not be confused with aria-describedby, which adds a supplementary accessible description such as a hint or error message. The name says what the control is; the description adds detail announced after it.
Writing an effective aria-label value
A good aria-label is short, specific and action-oriented, so the user understands the purpose of the control without seeing it. It should describe what the control does, not what the icon looks like.
- Write “Close dialog” rather than “X”, and “Search” rather than “Magnifying glass icon”.
- Do not include the role in the label: “Submit” is announced as “Submit, button”, so “Submit button” becomes redundant.
- Make repeated controls unique, for example “Delete invoice 1042” instead of five identical “Delete” buttons.
- When visible text exists, the accessible name should start with the visible text to satisfy WCAG 2.5.3 Label in Name and support voice control users.
- Keep the value in the page language and update it when the control state changes, or use aria-pressed or aria-expanded for state.
Relevant WCAG success criteria include 4.1.2 Name, Role, Value, which requires every user interface component to have a programmatic name, and 2.5.3 Label in Name, which requires the visible label text to appear in that name.
Common aria-label mistakes and how to fix them
Most aria-label defects found in an accessibility audit come from applying the attribute automatically or out of habit rather than from missing it entirely. Tools such as WAVE and Pa11y detect some problems, but manual testing with a screen reader such as NVDA remains necessary.
| Symptom | Cause | Fix |
|---|---|---|
| Visible link text is never announced | aria-label overrides content | Remove the attribute |
| Voice command “click Buy” fails | Label does not match visible text | Start the name with the visible words |
| Label not read on a div | Unsupported role | Use a button or add a valid role |
| English label on a translated page | Attribute not translated | Use visually hidden text |
| Icon announced as “image, chevron” | Decorative icon exposed | Hide the icon with aria-hidden |
An accessibility overlay that injects aria-label values automatically cannot reliably infer intent and often produces generic or misleading names. Fixing labels in the source code is the only dependable approach.
In everyday language
Some buttons on websites show only a small picture, such as an X or a magnifying glass. People who can see the screen understand them at a glance, but a blind person using software that reads the page aloud would hear nothing useful.
aria-label is a hidden name tag attached to such a button. Nobody sees it on screen, but the reading software says it out loud, for example “Close” or “Search”. The main rule is to use it only when there is no visible word, because the hidden tag replaces whatever text the button already shows.
Seen in the real world
An online grocery store runs an accessibility review before a public sector contract. Testing with NVDA reveals that the header contains six icon-only buttons, including cart, account and menu, which are announced only as “button”. Product cards also repeat “Add” forty times per page without saying which product.
The developers add aria-label values such as “Shopping cart, 3 items” and “Open main menu”, and change the product buttons to visible text “Add” with visually hidden text naming the product, so the accessible name becomes “Add Organic oat milk 1 liter”. They also remove an old aria-label on a promotional link that had been hiding its visible text.
The follow-up test shows no unnamed controls under WCAG 4.1.2, voice control users can say “click Add” successfully, and the translated Spanish version announces product names correctly because the hidden text is translated with the page.