Skip to content

Commit a2f36a6

Browse files
committed
Adjustments for [email protected]
1 parent ce73c70 commit a2f36a6

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

__mocks__/genInteractives.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Object.keys(interactiveElementsMap)
8989
);
9090

9191
const interactiveRoles = roleNames.filter(
92-
role => roles[role].interactive === true
92+
role => roles.get(role).interactive === true
9393
);
9494

9595
const nonInteractiveRoles = roleNames.filter(

src/util/isNonInteractiveElement.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
*/
44

55
import {
6-
roles,
6+
dom,
77
elementRoles,
8+
roles,
89
} from 'aria-query';
910
import type {
1011
JSXAttribute,
@@ -16,7 +17,6 @@ import {
1617
propName,
1718
} from 'jsx-ast-utils';
1819
import getTabIndex from './getTabIndex';
19-
import DOMElements from './attributes/DOM.json';
2020

2121
const nonInteractiveRoles = new Set(
2222
[...roles.keys()].filter(name => !roles.get(name).interactive),
@@ -84,7 +84,7 @@ const isNonInteractiveElement = (
8484
): boolean => {
8585
// Do not test higher level JSX components, as we do not know what
8686
// low-level DOM element this maps to.
87-
if (Object.keys(DOMElements).indexOf(tagName) === -1) {
87+
if ([...dom.keys()].indexOf(tagName) === -1) {
8888
return false;
8989
}
9090

src/util/isNonInteractiveRole.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import {
2+
dom,
3+
roles,
4+
} from 'aria-query';
15
import { getProp, getLiteralPropValue } from 'jsx-ast-utils';
2-
import DOMElements from './attributes/DOM.json';
3-
import roles from './attributes/role.json';
46

57

6-
const VALID_ROLES = Object.keys(roles)
7-
.filter(role => roles[role].interactive === false);
8+
const VALID_ROLES = [...roles.keys()]
9+
.filter(role => roles.get(role).interactive === false);
810
/**
911
* Returns boolean indicating whether the given element has a role
1012
* that is associated with a non-interactive component. Non-interactive roles
@@ -25,7 +27,7 @@ const VALID_ROLES = Object.keys(roles)
2527
const isNonInteractiveRole = (tagName, attributes) => {
2628
// Do not test higher level JSX components, as we do not know what
2729
// low-level DOM element this maps to.
28-
if (Object.keys(DOMElements).indexOf(tagName) === -1) {
30+
if ([...dom.keys()].indexOf(tagName) === -1) {
2931
return false;
3032
}
3133

0 commit comments

Comments
 (0)