Disallow labels associated with multiple controls
- Rule ID:
- multiple-labeled-controls
- Category:
- Accessibility
- Standards:
- WCAG 2.2 (A)
- WCAG 2.1 (A)
- WCAG 2.0 (A)
<label>
can only be associated with a single control at once.
It should either wrap a single labelable control or use the for
attribute to reference the control.
Rule details
Examples of incorrect code for this rule:
<label>
<input type="text">
<input type="text">
</label>
<label for="bar">
<input type="text" id="foo">
</label>
<input type="text" id="bar">
Examples of correct code for this rule:
<label>
<input type="text">
</label>
Version history
- 8.19.0 - Rule ignores properly ignores
<input type="hidden">
.