astro/jsx-a11y/label-has-associated-control
apply
jsx-a11y/label-has-associated-control
rule to Astro components
This rule is the same rule as jsx-a11y/label-has-associated-control rule but it applies to the Astro components.
You must have eslint-plugin-jsx-a11y installed to use this rule.
The following is a partial excerpt from the jsx-a11y/label-has-associated-control rule documentation. See original documentation for more details.
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
htmlFor
to a label and assigning it a DOM ID string that indicates an input on the page.This rule checks that any
label
tag (or an indicated custom component that will output alabel
tag) either (1) wraps aninput
element (or an indicated custom component that will output aninput
tag) or (2) has anhtmlFor
attribute and that thelabel
tag has text content.
📚 Further Reading
🚀 Version
This rule was introduced in eslint-plugin-astro v0.11.0
🔍 Implementation
Taken with ❤️ from eslint-plugin-jsx-a11yEdit this page
← astro/jsx-a11y/interactive-supports-focus Next Page
astro/jsx-a11y/lang →