Skip to content

Commit 25bd5ba

Browse files
author
Ethan Cohen
committed
[fix] - Fix crash when <ELEMENT role /> for role-supports-aria-props
1 parent ff4f086 commit 25bd5ba

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/rules/role-supports-aria-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = context => ({
3333
// If there is no explicit or implicit role, then assume that the element
3434
// can handle the global set of aria-* properties.
3535
// This actually isn't true - should fix in future release.
36-
if (!roleValue || ROLES[roleValue.toUpperCase()] === undefined) {
36+
if (typeof roleValue !== 'string' || ROLES[roleValue.toUpperCase()] === undefined) {
3737
return;
3838
}
3939

tests/src/rules/role-supports-aria-props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ ruleTester.run('role-supports-aria-props', rule, {
7070
{ code: '<Foo bar />', parserOptions },
7171
{ code: '<div />', parserOptions },
7272
{ code: '<div id="main" />', parserOptions },
73+
{ code: '<div role />', parserOptions },
7374
{ code: '<div role="presentation" {...props} />', parserOptions },
7475
{ code: '<Foo.Bar baz={true} />', parserOptions },
7576

0 commit comments

Comments
 (0)