What is aria-label? - Accessible Labels for Elements
Information about the article

Author: Dmitry Dugarev
The aria-label attribute is one of the best-known and simultaneously most frequently misunderstood tools in the world of digital accessibility. Used correctly, it is incredibly powerful for improving the user experience for users of assistive technologies (AT) like screen readers. Used incorrectly, however, it can do more harm than good. Let's dive deep together and clarify how to use aria-label correctly and effectively.
What is aria-label?
The official specification defines aria-label as follows:
Defines a string value that labels the current element. [1]
In English, this means: It defines a string value (a sequence of characters) that labels the current element.
Detailed Explanation
Imagine you have an interactive element, for example, a button that only contains an icon – like the classic "X" for closing a window. A sighted user recognizes the function immediately. But what does a user hear who uses a screen reader? Without further information, they might only hear "Button". That is not helpful.
This is where aria-label comes in. It provides this element with an "accessible name". This name is invisible to sighted users but is read out by assistive technologies. In the case of our "X" button, you would add aria-label="Close". The screen reader user then hears "Close, Button" – and immediately knows what happens when they activate it.
The most important thing you need to understand: aria-label has a high priority and overwrites any visible text content of the element for assistive technologies. If a button has the text "Learn more" and you give it an aria-label="Click here", the screen reader will read "Click here", not "Learn more". This can lead to great confusion.
The accessible name is determined according to a fixed hierarchy, defined in the "Accessible Name and Description Computation" specification [2]. aria-label is high up in this hierarchy.
Text description for the "Simplified Hierarchy of Accessible Name Computation" diagram
This flowchart shows the simplified process of how assistive technologies determine the name of an element.
- First, it checks if an
aria-labelledbyattribute is present. If so, its content is used as the name. - If not, it checks if an
aria-labelattribute is present. If so, its value is used as the name. - If not, the visible text content of the element is used as the name.
- As a last resort, the
titleattribute is used as a fallback. - If none of these methods provide a name, the element has no accessible name, which represents an accessibility problem.
Thus,
aria-labeloverwrites the visible text content.
What is it Used For?
aria-label is your tool of choice when there is no visible label or the visible label is not meaningful enough.
Typical use cases include:
- Icon Buttons: Buttons that only display an icon (e.g., a gear for "Settings", a magnifying glass for "Search", an "X" for "Close").
- Graphical Controls: Control elements whose function is represented purely visually.
- Unique Naming of Landmark Regions: If you have multiple navigation elements (
<nav>) on a page, you can differentiate them, e.g., witharia-label="Main navigation"andaria-label="Side navigation". - Clarifying Ambiguous Links: A "Read more" link is unclear without context. With
aria-label="Read more about our new product", it becomes understandable for screen reader users. (Although there are often better techniques here!)
Here is a small decision tree to help you:
Text description for the "Decision Tree for Using aria-label" diagram
aria-label" diagramThis diagram helps in deciding whether aria-label should be used. 1.
Question: Does the element have a visible label? 2. If no: aria-label is an
excellent choice. 3. If yes, proceed: Is the visible label sufficient? 4. If
yes: aria-label is not needed. 5. If no, proceed: Can the visible text be
improved? 6. If yes: Improve the visible text. That is the preferred solution.
7. If no: aria-label can be used as a last resort to supplement the context,
but caution is advised.
Practical Examples
- Good Example
- Bad Example
<!--
Good Example:
A button without visible text.
aria-label gives it an accessible name.
-->
<button aria-label="Close dialog">
<svg aria-hidden="true" focusable="false" ...>
<!-- Icon graphic here -->
<path
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
></path>
</svg>
</button>
<!--
Bad Example:
This button already has visible text ("Search").
The aria-label="Start search" overwrites this text.
This leads to inconsistency.
-->
<button aria-label="Start search">Search</button>
The bad example creates a problem:
- A screen reader user hears "Start search, Button".
- A user of speech recognition software might say "Click Search," which fails because the accessible name is "Start search."
- A sighted screen reader user is confused because they read "Search" but hear "Start search."
Best Practices & Recommendations
- Use
aria-labelonly when there is no visible label. This is the golden rule. If text is present, it is almost always better to design that text so that it is meaningful. - Never overwrite visible text. If an element has visible text, that text must be part of the accessible name. This is a direct requirement of the WCAG Success Criterion 2.5.3 Label in Name. [3]
- Prefer native HTML elements. For form fields, a
<label>element linked with theforattribute is always the better, more robust, and semantically correct solution thanaria-labelon an<input>. [4] - Be precise and brief. The content of
aria-labelshould be like a genuine, short label, not a novel. For longer descriptions, there isaria-describedby. - Do not use it on static elements like
<div>or<span>, unless they have a specific ARIA role (e.g.,role="navigation"orrole="region") that requires a label. Anaria-labelon a simple<div>without a role will be ignored by most screen readers. - Test your implementation! Nothing replaces testing with an actual screen reader (NVDA, VoiceOver, YesWS). This ensures that the user experience is truly what you envision.
Common Misunderstandings
aria-label is like a Tooltip
That is incorrect. The title attribute in HTML creates a tooltip that appears on mouse hover. aria-label produces no visual output whatsoever. It is intended exclusively for API communication with assistive technologies. While the title attribute sometimes serves as a last fallback for the accessible name, it is notoriously unreliable and often inaccessible to mobile or keyboard-only users. So, do not confuse the two.
aria-label is intended for long explanations
No, it is not suitable for that. aria-label is intended to be a short, concise label (the "Name"). If you want to provide additional information or instructions (the "Description"), aria-describedby is the correct tool. It links an element to another element on the webpage, whose content is then read aloud as the description.
Related Terms
- Accessible Name
- aria-labelledby
- aria-describedby
- role (attribute)
- WAI-ARIA
Frequently Asked Questions
What is the difference between aria-label and aria-labelledby?
aria-label uses a simple string as a label, which you write directly into the attribute. aria-labelledby is more powerful: It uses the id of one or more other elements on the page to concatenate their content as the label. aria-labelledby takes precedence over aria-label and is often the better choice if the label already exists as visible text on the webpage.
When should I NOT use aria-label?
You should not use aria-label if an element already has a visible and meaningful text label. Furthermore, you should not use it on generic, non-interactive elements like <div>, <p>, or <span> without an appropriate ARIA role, as it is often ignored there.
Does aria-label affect SEO?
No, aria-label generally has no direct impact on Search Engine Optimization (SEO). Search engine crawlers focus on the visible content and the semantic structure of the DOM. aria-label is intended for the user experience of AT users, not for search engines.
Can all HTML elements have an aria-label?
Technically, you can place the attribute on almost any HTML element. However, it is only useful and effective on elements that require a label. These are typically interactive elements (like button, a, input), elements with a landmark role (like nav, main), or widgets with an ARIA role (like tab, dialog).
Note
The information contained in this article, particularly references to legal regulations or standards such as the WCAG, is for general information purposes only and does not constitute legal advice. For specific legal questions regarding digital accessibility, you should always consult a qualified lawyer.