Skip to content

Commit 750a0f0

Browse files
Merge pull request #2660 from johanrd/night_fix/template-no-invalid-aria-attributes
Post-merge-review: Fix `template-no-invalid-aria-attributes`: reject boolean strings for string-typed ARIA attributes
2 parents 194fa33 + a2eda94 commit 750a0f0

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)