aria-label, aria-labelledby and aria-describedby: when to use each
All three attributes change what a screen reader announces, but they do different jobs. Two of them set an element’s accessible name (what it is called) and one sets its description (extra detail). Pick the wrong one and you either hide visible text from assistive technology or announce a label nobody can see.
Reviewed by Khushwant Parihar, CPACC
Updated
The short answer
| Attribute | Sets | Takes | Use it when |
|---|---|---|---|
aria-labelledby | Name | One or more IDs | The label is already visible on the page, such as a heading over a dialog or a section. |
aria-label | Name | A text string | There is no visible text to point to, such as an icon-only button. |
aria-describedby | Description | One or more IDs | The control already has a name and needs supporting detail: a hint, a format, an error. |
Before any of them, try native HTML. A <label for> on a form field, alt on an image, or real text inside a button names the element without ARIA and works everywhere. The first rule of ARIA is not to use it when HTML already does the job.
How browsers pick the name
Browsers compute one accessible name per element, following the W3C Accessible Name and Description Computation. Simplified, they take the first of these that produces text:
aria-labelledby, joining the text of every referenced element in order.aria-label.- The native label:
<label>,alt,<caption>,<legend>and so on. - The element’s own content, for roles that take their name from content (buttons, links, headings, tabs, options).
title, and for inputsplaceholder, as a last resort.
Two consequences catch people out. An aria-label on a link silently replaces the link text, and an aria-labelledby beats an aria-label on the same element. Check what you actually get with our accessible name previewer.
aria-label
The classic case is a control that shows an icon and no words:
<button type="button" aria-label="Close dialog">
<svg aria-hidden="true" focusable="false">...</svg>
</button>Hide the icon itself with aria-hidden="true" so it is not announced as a stray image. Other good uses: telling apart several <nav> landmarks (aria-label="Primary", aria-label="Footer") and naming a search field whose only visible label is a magnifying glass.
Keep it short, write it as a name rather than an instruction (“Close dialog”, not “Click to close the dialog”), and do not repeat the role: screen readers already say “button”. Because the text lives in an attribute, some machine translation tools leave it untranslated, which is one more reason to prefer visible text where you can.
aria-labelledby
Point at text that is already on screen, so the name and the visible label cannot drift apart:
<div role="dialog" aria-modal="true" aria-labelledby="dlg-title">
<h2 id="dlg-title">Delete project</h2>
...
</div>It can combine several IDs, including the element’s own, to build a fuller name:
<h3 id="plan-pro">Pro plan</h3>
<a href="/checkout/pro" id="buy-pro" aria-labelledby="buy-pro plan-pro">Buy now</a>
<!-- Announced as "Buy now Pro plan, link" -->The referenced text is used even if that element is hidden with hidden or display:none, which is handy for a label you do not want to show. Two limits: it is not followed more than one step (an element referenced by aria-labelledby does not contribute its own aria-labelledby), and every ID must exist, or that part of the name is silently dropped.
aria-describedby
Descriptions add detail after the name, role and state:
<label for="pw">Password</label>
<input id="pw" type="password" aria-describedby="pw-hint pw-error" aria-invalid="true">
<p id="pw-hint">At least 12 characters.</p>
<p id="pw-error">Password is too short.</p>A screen reader says something like “Password, edit, invalid entry. At least 12 characters. Password is too short.” Users can turn descriptions off or move on before they finish, so do not put the only copy of essential information in a description. A newer attribute, aria-description, takes a string instead of an ID. It is in the ARIA 1.3 draft and support across screen readers is still uneven, so prefer aria-describedby with visible text.
Where aria-label does nothing
WAI-ARIA 1.2 prohibits naming some roles. Browsers and screen readers may drop the label or read it unpredictably. The ones that matter most in practice:
- A plain
<div>or<span>, which has the generic role. role="presentation"androle="none".- Text-level roles:
paragraph,code,strong,emphasis,subscript,superscript,insertion,deletionandcaption.
If an element needs a name, it needs a role that can carry one. Often the honest fix is to make it a real <button>, <a>, <section> or <img>.
Common mistakes
- Label that contradicts the visible text. A button that shows “Search” but has
aria-label="Find products"fails 2.5.3 Label in Name, because voice-control users say what they see. - aria-label on every link.Overriding good link text with long labels makes pages slower to use. Fix vague text like “Read more” by writing better text, or add the subject with
aria-labelledbyor visually hidden text inside the link. - Duplicating a native label. An input with both
<label>and anaria-labeluses only thearia-label. Remove one. - Broken ID references. Generated or duplicated IDs (common in components rendered twice) leave the name empty. Check that every referenced ID is unique and present.
- Redundant role words.
aria-label="Menu button"is announced as “Menu button, button”.
Missing or wrong names on controls are failures of 4.1.2 Name, Role, Value.
React, Angular and Vue
React keeps ARIA attributes hyphenated, unlike most JSX props:
<button type="button" aria-label="Close dialog" onClick={onClose}>
<XIcon aria-hidden="true" />
</button>
// Generate stable IDs for aria-labelledby and aria-describedby
const hintId = useId()
<input aria-describedby={hintId} />
<p id={hintId}>At least 12 characters.</p>Angular needs attribute binding for dynamic values:
<button type="button" [attr.aria-label]="closeLabel">
<mat-icon aria-hidden="true">close</mat-icon>
</button>
<section [attr.aria-labelledby]="headingId">
<h2 [id]="headingId">Billing</h2>
</section>Vue binds them like any attribute: :aria-label="closeLabel". In every framework, make sure IDs are unique per component instance. More patterns are in our React, Angular and Vue guides.
How to test it
- Open the browser’s accessibility inspector (Chrome and Edge: Elements, then Accessibility; Firefox: Accessibility panel) and read the computed name and description.
- Run an automated check. axe and Lighthouse flag empty names, broken ID references and prohibited
aria-labeluse. - Listen with a screen reader. Tab through with NVDA or VoiceOver and confirm each control is announced the way its visible label reads. Our screen reader testing guide covers the commands.
- Try voice control. Say the visible label (“click Search”) in Voice Control or Dragon. If nothing happens, the name does not contain the label.
Frequently Asked Questions
What is the difference between aria-label and aria-labelledby?
aria-label gives an element its accessible name as a string written in the attribute. aria-labelledby points to the ID of one or more other elements and uses their text as the name. Prefer aria-labelledby when the label text is already visible on the page, because the name then stays in sync with what sighted users read and is translated with the page. If both are present, aria-labelledby wins.
Does aria-label work on a div or span?
Not reliably. A div or span with no role has the generic role, and WAI-ARIA 1.2 prohibits naming it. Some screen readers ignore the label and others read it inconsistently. Give the element a real role first (a button, a region, a group, an image) or put the text in the content instead.
Should I use aria-label or title?
Use visible text first, then aria-labelledby, then aria-label. The title attribute is the last fallback in name computation, shows only on mouse hover, never appears for keyboard or touch users, and is read inconsistently. Do not rely on title for anything people need.
Does aria-label override the text inside a button or link?
Yes. aria-label replaces the name a button or link would otherwise get from its content. That is why aria-label="Close" on a button that visibly says "Cancel" is a WCAG 2.5.3 Label in Name failure: a voice-control user who says "click Cancel" cannot activate it. Keep the visible words in the accessible name, ideally at the start.
How do I add aria-label in Angular?
Use attribute binding for dynamic values: [attr.aria-label]="label". A static value needs no binding: aria-label="Close dialog". For aria-labelledby and aria-describedby, bind the ID the same way: [attr.aria-labelledby]="titleId".
Is aria-describedby read automatically?
Usually, but after the name, role and state, and sometimes after a pause. Some users turn descriptions off. Use it for supporting information such as a password rule or an error message, never for the only copy of something essential.