@@ -10,9 +10,6 @@ import JSXElementMock from './JSXElementMock';
1010import type { JSXAttributeMockType } from './JSXAttributeMock' ;
1111import type { JSXElementMockType } from './JSXElementMock' ;
1212
13- const domElements = dom . keys ( ) ;
14- const roleNames = roles . keys ( ) ;
15-
1613const interactiveElementsMap = {
1714 a : [ { prop : 'href' , value : '#' } ] ,
1815 area : [ { prop : 'href' , value : '#' } ] ,
@@ -120,19 +117,19 @@ const nonInteractiveElementsMap: {[string]: Array<{[string]: string}>} = {
120117 ul : [ ] ,
121118} ;
122119
123- const indeterminantInteractiveElementsMap : { [ key : string ] : Array < any > } = Object . fromEntries ( domElements . map ( ( name ) => [ name , [ ] ] ) ) ;
120+ const indeterminantInteractiveElementsMap : { [ key : string ] : Array < any > } = Object . fromEntries ( dom . keys ( ) . map ( ( name ) => [ name , [ ] ] ) ) ;
124121
125122Object . keys ( interactiveElementsMap )
126123 . concat ( Object . keys ( nonInteractiveElementsMap ) )
127124 . forEach ( ( name ) => delete indeterminantInteractiveElementsMap [ name ] ) ;
128125
129- const abstractRoles = roleNames . filter ( ( role ) => roles . get ( role ) . abstract ) ;
126+ const abstractRoles = roles . keys ( ) . filter ( ( role ) => roles . get ( role ) . abstract ) ;
130127
131- const nonAbstractRoles = roleNames . filter ( ( role ) => ! roles . get ( role ) . abstract ) ;
128+ const nonAbstractRoles = roles . keys ( ) . filter ( ( role ) => ! roles . get ( role ) . abstract ) ;
132129
133130const interactiveRoles = [ ]
134131 . concat (
135- roleNames ,
132+ roles . keys ( ) ,
136133 // 'toolbar' does not descend from widget, but it does support
137134 // aria-activedescendant, thus in practice we treat it as a widget.
138135 'toolbar' ,
@@ -142,7 +139,7 @@ const interactiveRoles = []
142139 && roles . get ( role ) . superClass . some ( ( klasses ) => klasses . includes ( 'widget' ) )
143140 ) ) ;
144141
145- const nonInteractiveRoles = roleNames
142+ const nonInteractiveRoles = roles . keys ( )
146143 . filter ( ( role ) => (
147144 ! roles . get ( role ) . abstract
148145 && ! roles . get ( role ) . superClass . some ( ( klasses ) => klasses . includes ( 'widget' ) )
0 commit comments