Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jonleighton opened this issue Feb 21, 2022 · 0 comments

Comments

@jonleighton
Copy link
Contributor

<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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant