When It's Possible, Use Existing Non-ARIA Elements for Names and Labels
When It's Possible, Use Existing Non-ARIA Elements for Names and Labels
The aria-label
and aria-labelledby
attributes allow you to add names and labels to just about any HTML element. It is important to remember, though, that these attributes do not need to be used everywhere, especially when there are non-ARIA elements that already supply names and labels. Whenever possible, try to use these non-ARIA elements as the true purpose behind ARIA is to fill in holes where methods do not exist. Below are examples of non-ARIA elements for names and labels that can be used instead of aria-label
and aria-labelledby
attributes.
Examples of Non-ARIA Names and Labels
- The element
<label>
tag designates the label for a form<input>
. - The
<legend>
labels<fieldset>
elements (groups of form elements). - The
<th>
tag designates a table header cell (as opposed to<td>
for table data cells). - The
alt
attribute serves as the name, or text replacement, for an image. - The
<title>
tag designates the name of a web page.