liveBook · Manning

Label element

As explained in Architecting Accessibility

An HTML element that labels a form control and can programmatically associate the control with its visible label.

A visible label helps people identify a form control; programmatically associating it also helps screen-reader and voice-control users find the field. Labels enlarge the clickable area of checkboxes and radio buttons. Keep labels visible rather than relying on placeholders, which are not labels. section 6.1.1

<label for="name">Owner’s name</label> #A
<input name="name" id="name" type="text" /> #A

Pair the label’s `for` value with the control’s matching `id` to create an explicit association. section 6.1.1

Use the native `<label>` for a control’s primary name. Put supplementary instructions nearby and associate them with `aria-describedby`; avoid overriding a native label with an incomplete `aria-label` or `aria-labelledby` name. section 6.1.2 section 6.1.1

How Architecting Accessibility covers it

How deep it goes
Specifies `for`/`id` association and its effects for screen readers, voice control, and click targets, while warning about ARIA overrides.
Examples
Shows an “Owner’s name” label paired with its input and a “Payment amount” label affected by an incomplete ARIA name.
What you can do after
Apply the native HTML element by matching each label’s `for` value to its control’s `id`.
How it connects
Relates labels to accessible names, `aria-describedby`, and form grouping with `fieldset` and `legend`.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.