elixir-wallaby/wallaby

Wallaby can't fill in an input that is implicitly associated with its label via nesting

jonleighton opened this issue · 0 comments

<input> elements may be nested inside a <label> element, and in this case the association is implicit and a for attribute is not needed on the <label>. Example from MDN:

<label>Do you like peas?
  <input type="checkbox" name="peas">
</label>

Wallaby doesn't support this use case, at least when selecting an option in a radio list. It raises this errors:

 ▏ ▏** (Wallaby.QueryError) The text '...' matched a label but the label has no 'for'
 ▏ ▏attribute and can't be used to find the correct element.

 ▏ ▏You can fix this by including the `for="YOUR_INPUT_ID"` attribute on the
 ▏ ▏appropriate label.