7
7
import { AXObjects , AXObjectRoles , elementAXObjects } from 'axobject-query' ;
8
8
import Attribute from '../nodes/Attribute' ;
9
9
10
- const non_abstract_roles = [ ...roles_map . keys ( ) ] . filter ( ( name ) => ! roles_map . get ( name ) . abstract ) ;
10
+ const non_abstract_roles = [ ...roles_map . keys ( ) ] . filter ( ( name ) => ! roles_map . get ( name ) . abstract && name !== 'generic' ) ;
11
11
12
12
const non_interactive_roles = new Set (
13
13
non_abstract_roles
@@ -82,6 +82,10 @@ const interactive_ax_objects = new Set(
82
82
[ ...AXObjects . keys ( ) ] . filter ( ( name ) => AXObjects . get ( name ) . type === 'widget' )
83
83
) ;
84
84
85
+ const non_interactive_ax_objects = new Set (
86
+ [ ...AXObjects . keys ( ) ] . filter ( ( name ) => [ 'windows' , 'structure' ] . includes ( AXObjects . get ( name ) . type ) )
87
+ ) ;
88
+
85
89
const interactive_element_ax_object_schemas : ARIARoleRelationConcept [ ] = [ ] ;
86
90
87
91
elementAXObjects . entries ( ) . forEach ( ( [ schema , ax_object ] ) => {
@@ -90,6 +94,15 @@ elementAXObjects.entries().forEach(([schema, ax_object]) => {
90
94
}
91
95
} ) ;
92
96
97
+ const non_interactive_element_ax_object_schemas : ARIARoleRelationConcept [ ] = [ ] ;
98
+
99
+ elementAXObjects . entries ( ) . forEach ( ( [ schema , ax_object ] ) => {
100
+ if ( [ ...ax_object ] . every ( ( role ) => non_interactive_ax_objects . has ( role ) ) ) {
101
+ non_interactive_element_ax_object_schemas . push ( schema ) ;
102
+ }
103
+ } ) ;
104
+
105
+
93
106
function match_schema (
94
107
schema : ARIARoleRelationConcept ,
95
108
tag_name : string ,
@@ -141,6 +154,41 @@ export function is_interactive_element(
141
154
return false ;
142
155
}
143
156
157
+ export function is_non_interactive_element (
158
+ tag_name : string ,
159
+ attribute_map : Map < string , Attribute >
160
+ ) : boolean {
161
+ if ( tag_name === 'header' ) {
162
+ return false ;
163
+ }
164
+
165
+ if (
166
+ non_interactive_element_role_schemas . some ( ( schema ) =>
167
+ match_schema ( schema , tag_name , attribute_map )
168
+ )
169
+ ) {
170
+ return true ;
171
+ }
172
+
173
+ if (
174
+ interactive_element_role_schemas . some ( ( schema ) =>
175
+ match_schema ( schema , tag_name , attribute_map )
176
+ )
177
+ ) {
178
+ return false ;
179
+ }
180
+
181
+ if (
182
+ non_interactive_element_ax_object_schemas . some ( ( schema ) =>
183
+ match_schema ( schema , tag_name , attribute_map )
184
+ )
185
+ ) {
186
+ return true ;
187
+ }
188
+
189
+ return false ;
190
+ }
191
+
144
192
export function is_semantic_role_element ( role : ARIARoleDefintionKey , tag_name : string , attribute_map : Map < string , Attribute > ) {
145
193
for ( const [ schema , ax_object ] of elementAXObjects . entries ( ) ) {
146
194
if ( schema . name === tag_name && ( ! schema . attributes || schema . attributes . every (
0 commit comments