aria-label
Characteristics
Type:
- DOMString
Related Concepts:
- title in HTML.
See Related:
- aria-labelledby
Used in Roles:
- All elements of the base markup. (Global)
- No role required
Value:
- string
Defines a string value that labels the current element.
The purpose of aria-label is the same as that of aria-labelledby. It provides the user with a recognizable name of the object. The most common accessibility API mapping for a label is the accessible name property.
The aria-label attribute can be used when:
- the name of an element cannot be determined programmatically from the content of the element
- providing a visible label and/or tooltip is not the desired user experience
If the label text is visible on screen, authors should use aria-labelledby and should not use aria-label. There may be instances where the name of an element cannot be determined programmatically from the content of the element, and there are cases where providing a visible label is not the desired user experience.
Most host languages provide an attribute that could be used to name the element (e.g., the title attribute in HTML, yet this could present a browser tooltip. In the cases where a visible label or visible tooltip is undesirable, authors may set the accessible name of the element using aria-label. As required by the text alternative computation, user agents give precedence to aria-labelledby over aria-label when computing the accessible name property.
Syntax
<element aria-label="..." ... />