Repository navigation
BUGFIX: template-no-redundant-role — use input type to determine implicit role - #2873
Merged
NullVoxPopuli merged 2 commits intoOct 29, 2026
Merged
Conversation
NullVoxPopuli
approved these changes
Oct 29, 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.
Fixes #2856. Thanks to @BoussonKarel for the report.
The rule mapped roles to tag names only (
spinbutton: ['input'], etc.) and ignoredtype. So<input type="text" role="spinbutton">was reported and autofixed away, although the implicit role of that input istextbox, notspinbutton.This adds
getInputImplicitRole, in the same shape as the existinggetSelectImplicitRole. It derives the implicit role from a statictype, per HTML-AAM:text,email,tel,url→textboxsearch→searchbox,number→spinbutton,range→slidercheckbox→checkbox,radio→radiobutton,submit,reset,image→buttonlistattribute on a text or search input →comboboxpassword,hidden,dateand the like → no implicit roleThe role is only reported when it equals that implicit role. A dynamic
typeorlistskips the report, so there is no autofix in that case.Tests (gjs and hbs):
spinbuttonandsearchboxontype="text",sliderontype="number",role="checkbox"without a type, a dynamictype, andtextboxwithlistare now valid.spinbuttonontype="number"andtextboxwith no type are still reported and fixed. The new valid cases fail without the fix.vitest run tests/lib/rules/template-no-redundant-role.js: 89 passed; with only the rule change reverted, the 12 new valid cases fail.Replaces #2871, which got closed when my fork was accidentally detached.