fix(require-input-label): don't count id as extra label when aria-label/labelledby present#2767
Merged
NullVoxPopuli merged 3 commits intoember-cli:masterfrom Apr 30, 2026
Conversation
…gative Refs: ember-template-lint/ember-template-lint#3388 - id + aria-label wrongly flagged as multipleLabels (false positive) - id alone not flagged as missing label (false negative)
…bel/labelledby Refs: ember-template-lint/ember-template-lint#3388 id alone cannot be verified statically as a <label for> reference (same rationale as vuejs-accessibility form-control-has-label). Counting it as a second label when aria-label or aria-labelledby is already present causes a false positive multipleLabels error. Keep the bail-out for id-only inputs (no real labels present) to avoid flagging inputs that likely have an off-screen <label for> sibling.
Draft
3 tasks
…el cases - Add valid: <input id aria-labelledby> (GJS + HBS) - Add invalid: <label><input id aria-label></label> still multipleLabels — locks in the corrected behavior after the validLabel && hasId carve-out was removed. - Drop peer-plugin reference from the id-skip comment; keep the spec-anchored reason (static analysis can't verify the <label for>) and inline the one-shot aria-label/labelledby locals.
NullVoxPopuli
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the false positive reported in ember-template-lint/ember-template-lint#3388.
<input id='hello' aria-label='hello' />was wrongly flagged asmultipleLabelsbecauseidwas counted as a label alongsidearia-label. Anidattribute alone cannot be verified statically as a<label for>reference — a matching sibling label may or may not exist elsewhere in the template. Counting it as a second label whenaria-labeloraria-labelledbyis already present is a false positive.What changes:
idis no longer counted towardlabelCountwhen other labels (aria-label,aria-labelledby, or a wrapping<label>) are already presentid-only inputs is preserved (noaria-labeland no wrapping label → skip, to avoid flagging inputs that have an off-screen<label for>sibling we can't see)What does NOT change:
<input id="foo" />→ still valid (false negative acknowledged; within-template<label for>traversal is a separate feature — see angular-eslintlabel-has-associated-controlwithcheckIds: truefor the two-pass approach)Will try to fix in an upcoming pr.
Test plan
<input id="hello" aria-label="hello" />— no longer flagged<input aria-label="a" aria-labelledby="b" />— still flagged (multipleLabels)<input id="foo" />— still valid