Skip to main content

label-no-enc-textarea-or-select

A rule from WCAG http://oaa-accessibility.org/wcag20/rule/74/. The label element should not encapsulate select and textarea elements.

The following patterns are considered violations:

  <label>
<select>
<option value="v1">V1</option>
<option value="v2">V2</option>
<option value="v3">V3</option>
</select>
</label>
  <label>
<textarea></textarea>
</label>
  <label>
<div>
<div>
<select>
<option value="v1">V1</option>
<option value="v2">V2</option>
<option value="v3">V3</option>
</select>
</div>
</div>
</label>

The following patterns are not considered violations:

  <label for="select">Foo</label>
<select id="select">
<option value="bar">Bar</option>
</select>
  <label for="textarea">Fizz</label>
<textarea id="textarea"></textarea>