Skip to content

Commit 8145d31

Browse files
committed
Fixing JS erros while running against test data
1 parent ea819d6 commit 8145d31

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/rules/no-noninteractive-element-handlers.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import isAbstractRole from '../util/isAbstractRole';
2121
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';
2222
import isInteractiveElement from '../util/isInteractiveElement';
2323
import isInteractiveRole from '../util/isInteractiveRole';
24+
import isNonInteractiveElement from '../util/isNonInteractiveElement';
25+
import isNonInteractiveRole from '../util/isNonInteractiveRole';
2426
import isPresentationRole from '../util/isPresentationRole';
2527

2628
const errorMessage =
@@ -65,6 +67,10 @@ module.exports = {
6567
} else if (
6668
isInteractiveElement(type, attributes)
6769
|| isInteractiveRole(type, attributes)
70+
|| (
71+
!isNonInteractiveElement(type, attributes)
72+
&& !isNonInteractiveRole(type, attributes)
73+
)
6874
|| isAbstractRole(type, attributes)
6975
) {
7076
// This rule has no opinion about abtract roles.

src/util/isInteractiveElement.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ const pureInteractiveRoleElements = [...elementRoles.entries()]
3737
): ElementCallbackMap => {
3838
const interactiveElements = accumulator;
3939
const elementName = elementSchema.name;
40-
const elementAttributes = elementSchema.attributes || new Map([]);
40+
const elementAttributes = elementSchema.attributes || [];
4141
interactiveElements[elementName] = (attributes: Array<Node>): boolean => {
4242
const passedAttrCheck =
43-
elementAttributes.size === 0 ||
44-
[...elementAttributes.values()].every(
43+
elementAttributes.length === 0 ||
44+
elementAttributes.every(
4545
(controlAttr): boolean => attributes.some(
4646
(attr): boolean => (
4747
controlAttr.name === propName(attr).toLowerCase()

0 commit comments

Comments
 (0)