Skip to content

Commit ce6e22f

Browse files
committed
fix(template-no-noninteractive-tabindex): case-insensitive attribute-name lookup for tabIndex / TABINDEX (Copilot review)
1 parent 5f4dda3 commit ce6e22f

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

lib/rules/template-no-noninteractive-tabindex.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ function buildInteractiveRoleSet() {
3434
}
3535

3636
function findAttr(node, name) {
37-
return node.attributes?.find((a) => a.name === name);
37+
// HTML attribute names are case-insensitive. Normalize both sides so
38+
// `tabindex`, `tabIndex`, and `TABINDEX` all match the same lookup.
39+
// LLM-generated templates commonly emit `tabIndex` (React convention).
40+
const target = name.toLowerCase();
41+
return node.attributes?.find((a) => a.name?.toLowerCase() === target);
3842
}
3943

4044
function getStaticTabindexValue(attr) {

tests/lib/rules/template-no-noninteractive-tabindex.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ ruleTester.run('template-no-noninteractive-tabindex', rule, {
8686
output: null,
8787
errors: [{ messageId: 'noNonInteractiveTabindex' }],
8888
},
89+
// HTML attribute names are case-insensitive. LLM-generated Ember
90+
// templates often emit the React-style camelCase `tabIndex`; a fully
91+
// uppercase `TABINDEX` is also valid per spec. Both must still flag.
92+
{
93+
code: '<template><div tabIndex="0"></div></template>',
94+
output: null,
95+
errors: [{ messageId: 'noNonInteractiveTabindex' }],
96+
},
97+
{
98+
code: '<template><div TABINDEX="0"></div></template>',
99+
output: null,
100+
errors: [{ messageId: 'noNonInteractiveTabindex' }],
101+
},
89102
{
90103
code: '<template><article tabindex="0">Story</article></template>',
91104
output: null,

0 commit comments

Comments
 (0)