False Positive: Multiple <label>s marked as errors
See original GitHub issueExpectation: For a field with with multiple <label>
elements, Axe flags it as a warning (using should language).
Actual: When Axe encounters a field with with multiple <label>
elements, it flags this as an error (using must language).
Motivation: Because it generates false positives.
To Reproduce:
- Go to https://s.codepen.io/aardrian/debug/WVJvjM
- Inspect the page with Axe extension.
- View the Violations found column.
Sample Code:
<form>
<label for="a">ham</label>
<input type="text" id="a">
<label for="a">bone</label>
</form>
Why Axe Does This: The Deque page explaining this rule confirms this is considered a failure, suggesting this is not a software bug:
- Statement: “Form fields do not have duplicate labels”
- Statement: “Ensure that only one label is assigned to a form field.”
- The following compliance data is included on the page:
Requirement(s)
- WCAG 2.1 (A): MUST
- WCAG 2.0 (A): MUST
- Section 508: MUST
WCAG Success Criteria
- 3.3.2 Labels or Instructions
Section 508 Guidelines
- 1194.22 (n) Information required to complete electronic forms online
Why I Think Axe Should Not:
- Section 508 1194.22(n) does not explicitly forbid multiple
<label>
s. - Nothing in the
<label>
techniques for 1.1.1, 1.3.1, 3.3.2, nor 4.1.2 (H44) forbids multiple<label>
s. - Multiple
<label>
s is valid HTML (tested by pasting the code into the Nu HTML Validator). - HTML Accessibility API Mappings 1.0 explicitly references how to address multiple
<label>
s (concatenate by DOM order) suggesting these are valid. - While https://scottaohara.github.io/tests/html-inputs/double-label.html shows us that some AT combinations choke on this, AT bugs are not WCAG failures — barring those cases where all AT decide not to implement something as specc’d, in which case not actually a bug so still not a failure.
Testing tool comparison: The three tools I see most in use all flag this as an error.
- Axe: must implies error: “Form field must not have multiple label elements” (as 3.3.2),
- WAVE: Error: “A form control has more than one label associated with it.” (as 1.1.1, 1.3.1, 2.4.6, 3.3.2),
- ARC: “Error: multiple form labels used”.
Alternate Outcome: You tell me I am a wrong wrongerson and tell me to bugger off.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Multiclass Classification Model Evaluation - Parasite ID
False Positives ( FP ): Items where the true label is negative and whose class is incorrectly predicted to be positive .
Read more >require-input-label: "Multiple labels" false positive · Issue #2141
This case should not trigger the "form elements should not have multiple labels" error, because the id could be used for things other...
Read more >Precision, Recall, Accuracy, and F1 Score for Multi-Label ...
False positives, also known as Type I errors. This is when a classifier predicts a label that does not exist in the input...
Read more >True vs. False and Positive vs. Negative | Machine Learning
A false positive is an outcome where the model incorrectly predicts the positive class.
Read more >Confusion Matrix for Multi-Class Classification - Analytics Vidhya
Confusion Matrix has 4 terms to understand True Positive(TP),False Positive(FP),True Negative(TN) and False Negative(FN).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Relevant docs has been updated - https://dequeuniversity.com/rules/axe/3.5/form-field-multiple-labels
Sorry @patrickhulce, I must have missed your comment. Reopening the ticket and we’ll update the docs to use should (thanks @AutoSponge for commenting so I found this again)