liveBook · Manning

For attribute

As explained in Architecting Accessibility

An HTML attribute on a label element that associates the label with a form control by matching the control’s id.

A visible label helps people identify a form field. Set its `for` value to the field’s `id` to associate them, so screen readers can announce the label and voice-control users can refer to it. section 6.1.1

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

This pairs the “Owner’s name” label with the text field by matching `for="name"` to `id="name"`. section 6.1.1

How Architecting Accessibility covers it

How deep it goes
Defines the matching `for` and `id` values and explains their benefits for screen readers, voice control, and checkbox or radio activation.
Examples
Shows an “Owner’s name” label associated with a text input through matching `for` and `id` values.
What you can do after
Apply it via native HTML by matching a label’s `for` value to its control’s `id`.
How it connects
Connects HTML labels and form controls with accessible names, screen readers, and voice control.

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.