aria-label
An ARIA attribute that gives an element its accessible name directly as a text string.
In more detail
It overrides the element's text content and is essential for icon-only buttons, such as aria-label="Close". It is ignored when aria-labelledby is also present, and it is not visible, so visible text is preferred when there is some.
Example
In the browser: aria-label="Main" on a nav distinguishes it from other navigation landmarks. A related attribute, aria-labelledby, points to an existing element whose text becomes the name instead.Related terms
- accessible name — The text assistive technology uses to identify a control, such as "Delete account" for a button.
- aria-labelledby — An ARIA attribute that names an element using the text of one or more other elements, referenced by their id.
- Accessible Name and Description Computation — The W3C algorithm browsers follow to work out an element's accessible name and description from its attributes and content.
- ARIA — The W3C standard of HTML attributes, such as role and aria-expanded, that tell assistive technology what a custom widget is and what state it is in.
- nav element — The HTML element for a block of major navigation links, exposed as a navigation landmark.
Taught in
- WAI-ARIA Semantics: Roles, States & Accessible Name Computation — Design Systems & Component Engineering
- Semantic HTML Elements: Landmarks And Structure — Frontend Architecture & Web Platform
- Accessibility Tree, ARIA Roles, States And Live Regions — Frontend Architecture & Web Platform