Skip to content

Files

Latest commit

 

History

History
25 lines (15 loc) · 636 Bytes

a11y-label-has-associated-control.md

File metadata and controls

25 lines (15 loc) · 636 Bytes

Pattern: Malformed label tag

Issue: -

Description

Enforce that a label tag has a text label and an associated control.

There are two supported ways to associate a label with a control:

  • Wrapping a control in a label tag.
  • Adding for to a label and assigning it the ID of an input on the page.
<label for="id">B</label>

<label>C <input type="text" /></label>

<!-- A11y: A form label must be associated with a control. -->
<label>A</label>

Further Reading