You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tested the issue with the latest version of the product
Issue Description
Expectation
That the VS Code extension or GitHub Action linter would flag the following code as an error based on there is no explicit relationship between the label and the input.
<label>First Name</label>
<input type="text" />
Actual
The code does not produce an error in either VS Code or the linter, despite there being no ID/for, ID/aria-labelledby, or other marker to make a relationship between the input and label. Believe this should be an error based upon the Label rule
<label>First Name</label>
<input type="text" />
How to Reproduce
Created a React application, and have the following code in the App.js file.
Thanks for the issue. Since axe-linter runs on non-complete trees of HTML (things like React, Vue, and Angular components, as well as just random HTML code without a full page) it can't know if the code in question will be used inside a component that would then wrap the input with a label in the final output. Because of this many relational based rules won't run unless it detects you're running in a full page. That is, there's an <html> or <body> element at the root. If you wrap the code in question in an either of those you should see an error for the missing label.
Thanks for the issue. Since axe-linter runs on non-complete trees of HTML (things like React, Vue, and Angular components, as well as just random HTML code without a full page) it can't know if the code in question will be used inside a component that would then wrap the input with a label in the final output. Because of this many relational based rules won't run unless it detects you're running in a full page. That is, there's an <html> or <body> element at the root. If you wrap the code in question in an either of those you should see an error for the missing label.
Appreciate the added context and suggestion. When I created a basic index.html page with the same code provided here I did in fact see the error Ensures every form element has a label. Will close out issue.
Product
axe Linter
Product Version
4.8.3
Latest Version
Issue Description
Expectation
That the VS Code extension or GitHub Action linter would flag the following code as an error based on there is no explicit relationship between the label and the input.
Actual
The code does not produce an error in either VS Code or the linter, despite there being no ID/for, ID/aria-labelledby, or other marker to make a relationship between the input and label. Believe this should be an error based upon the Label rule
How to Reproduce
Created a React application, and have the following code in the App.js file.
Code snippet in context of App.js file.
Additional context
I've also tried removing the label element entirely to see if a single input could trigger an error and was not successful.
Appreciate feedback if I'm interpreting the label rule correctly or this example is expected behavior
The text was updated successfully, but these errors were encountered: