Skip to content

Commit 85b5b74

Browse files
committed
fix(template-interactive-supports-focus): trim contenteditable before false comparison
1 parent d924e2a commit 85b5b74

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/rules/template-interactive-supports-focus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function isContentEditable(node) {
117117
if (attr.value.type !== 'GlimmerTextNode') {
118118
return true;
119119
}
120-
return attr.value.chars.toLowerCase() !== 'false';
120+
return attr.value.chars.trim().toLowerCase() !== 'false';
121121
}
122122

123123
// Return the first RECOGNISED role token that's interactive — or null if no

tests/lib/rules/template-interactive-supports-focus.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,13 @@ ruleTester.run('template-interactive-supports-focus', rule, {
279279
output: null,
280280
errors: [{ messageId: 'focusable', data: { tag: 'div', role: 'textbox' } }],
281281
},
282+
// Whitespace around "false" — trim before comparison so " false " is still
283+
// an explicit opt-out (HTML treats the value as case-insensitive trimmed).
284+
{
285+
code: '<template><div role="textbox" contenteditable=" false ">x</div></template>',
286+
output: null,
287+
errors: [{ messageId: 'focusable', data: { tag: 'div', role: 'textbox' } }],
288+
},
282289

283290
// === Multi-token role where the FIRST token is interactive (WAI-ARIA
284291
// §4.1: only the first valid role applies; the rest are fallbacks). ===

0 commit comments

Comments
 (0)