Skip to content

Commit a2eda94

Browse files
committed
fix(template-no-invalid-aria-attributes): align string type validation with upstream
String-type ARIA attributes (aria-label, aria-keyshortcuts, etc.) now reject boolean values ("true"/"false"), matching upstream's fall-through from 'string' to 'id' case in validityCheck.
1 parent b705850 commit a2eda94

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/rules/template-no-invalid-aria-attributes.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ function isValidAriaValue(attrName, value) {
2828
case 'tristate': {
2929
return isBoolean(value) || value === 'mixed';
3030
}
31-
case 'string': {
32-
return typeof value === 'string';
33-
}
31+
case 'string':
3432
case 'id': {
3533
return typeof value === 'string' && !isBoolean(value);
3634
}

tests/lib/rules/template-no-invalid-aria-attributes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ ruleTester.run('template-no-invalid-aria-attributes', rule, {
116116
output: null,
117117
errors: [{ messageId: 'invalidAriaAttributeValue' }],
118118
},
119+
{
120+
code: '<template><div aria-label="true"></div></template>',
121+
output: null,
122+
errors: [{ messageId: 'invalidAriaAttributeValue' }],
123+
},
119124
],
120125
});
121126

0 commit comments

Comments
 (0)