The neighbourhood head’s night-watch form: a red string ties each label to the control label.control finds, a click on the label text is passed on by the…
Why it matters
A label that is not wired = a screen reader says "edit text", the click area is as small as the box (thumbs struggle with checkboxes), and getByLabelText tests fail. It is the most common accessibility audit finding. One correct <label> fixes all of it.
The key idea
A wired label does two jobs: a name + a click area
Common mistakes
Thinking a placeholder can stand in for a label A placeholder does become a fallback name (accname’s last step), but it vanishes once typed into, has low contrast and adds no click area. Keep a <label>; the placeholder is only for a format example (081xxx).
Clicking the label text never brings focus to the fieldfor must equal the field’s id exactly, and its target must be a labelable element (input, select, textarea, button…), not a div. Check label.control: null means a dead-end label. Or wrap the field in the label so no id is needed.
Relying on aria-label for every field That only helps screen readers; sighted people get no text at all, and the click area does not grow. Use a visible <label> by default; aria-label for controls with no text (an icon search button, say).
Try it in this playground
Open for / id (More examples), then click the text "Email" The browser passes the click on to the field: it gets focus, and the neighbourhood head’s string lights up.
Open Placeholder only, then type into the field:placeholder-shown turns false: the "Email" hint vanishes, though it was the field’s only name.
Open aria-label only Mr. Sugeng gets the name "Email", but Wulan sees no text at all.
In The for attribute, click the text "Email"label.control = null: the click stops at the text, and the neighbourhood head’s string hangs loose.