aria-api 0.2.7 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -3
- package/dist/aria.js +799 -473
- package/index.js +4 -0
- package/lib/atree.js +90 -0
- package/lib/attrs.js +115 -0
- package/lib/constants.js +471 -253
- package/lib/name.js +31 -65
- package/lib/query.js +26 -121
- package/package.json +5 -4
- package/CHANGES.md +0 -102
- package/dist/aria.min.js +0 -1
- package/lib/util.js +0 -28
package/lib/constants.js
CHANGED
|
@@ -1,64 +1,57 @@
|
|
|
1
|
+
// https://www.w3.org/TR/wai-aria/#state_prop_def
|
|
1
2
|
exports.attributes = {
|
|
2
|
-
|
|
3
|
+
'activedescendant': 'id',
|
|
4
|
+
'atomic': 'bool',
|
|
3
5
|
'autocomplete': 'token',
|
|
6
|
+
'busy': 'bool',
|
|
4
7
|
'checked': 'tristate',
|
|
8
|
+
'colcount': 'int',
|
|
9
|
+
'colindex': 'int',
|
|
10
|
+
'colspan': 'int',
|
|
11
|
+
'controls': 'id-list',
|
|
5
12
|
'current': 'token',
|
|
13
|
+
'describedby': 'id-list',
|
|
14
|
+
'details': 'id',
|
|
6
15
|
'disabled': 'bool',
|
|
16
|
+
'dropeffect': 'token-list',
|
|
17
|
+
'errormessage': 'id',
|
|
7
18
|
'expanded': 'bool-undefined',
|
|
19
|
+
'flowto': 'id-list',
|
|
20
|
+
'grabbed': 'bool-undefined',
|
|
8
21
|
'haspopup': 'token',
|
|
9
|
-
'hidden': 'bool',
|
|
22
|
+
'hidden': 'bool-undefined',
|
|
10
23
|
'invalid': 'token',
|
|
11
24
|
'keyshortcuts': 'string',
|
|
12
25
|
'label': 'string',
|
|
26
|
+
'labelledby': 'id-list',
|
|
13
27
|
'level': 'int',
|
|
28
|
+
'live': 'token',
|
|
14
29
|
'modal': 'bool',
|
|
15
30
|
'multiline': 'bool',
|
|
16
31
|
'multiselectable': 'bool',
|
|
17
32
|
'orientation': 'token',
|
|
33
|
+
'owns': 'id-list',
|
|
18
34
|
'placeholder': 'string',
|
|
35
|
+
'posinset': 'int',
|
|
19
36
|
'pressed': 'tristate',
|
|
20
37
|
'readonly': 'bool',
|
|
38
|
+
'relevant': 'token-list',
|
|
21
39
|
'required': 'bool',
|
|
22
40
|
'roledescription': 'string',
|
|
23
|
-
'selected': 'bool-undefined',
|
|
24
|
-
'valuemax': 'number',
|
|
25
|
-
'valuemin': 'number',
|
|
26
|
-
'valuenow': 'number',
|
|
27
|
-
'valuetext': 'string',
|
|
28
|
-
|
|
29
|
-
// live
|
|
30
|
-
'atomic': 'bool',
|
|
31
|
-
'busy': 'bool',
|
|
32
|
-
'live': 'token',
|
|
33
|
-
'relevant': 'token-list',
|
|
34
|
-
|
|
35
|
-
// dragndrop
|
|
36
|
-
'dropeffect': 'token-list',
|
|
37
|
-
'grabbed': 'bool-undefined',
|
|
38
|
-
|
|
39
|
-
// relationship
|
|
40
|
-
'activedescendant': 'id',
|
|
41
|
-
'colcount': 'int',
|
|
42
|
-
'colindex': 'int',
|
|
43
|
-
'colspan': 'int',
|
|
44
|
-
'controls': 'id-list',
|
|
45
|
-
'describedby': 'id-list',
|
|
46
|
-
'details': 'id',
|
|
47
|
-
'errormessage': 'id',
|
|
48
|
-
'flowto': 'id-list',
|
|
49
|
-
'labelledby': 'id-list',
|
|
50
|
-
'owns': 'id-list',
|
|
51
|
-
'posinset': 'int',
|
|
52
41
|
'rowcount': 'int',
|
|
53
42
|
'rowindex': 'int',
|
|
54
43
|
'rowspan': 'int',
|
|
44
|
+
'selected': 'bool-undefined',
|
|
55
45
|
'setsize': 'int',
|
|
56
46
|
'sort': 'token',
|
|
47
|
+
'valuemax': 'number',
|
|
48
|
+
'valuemin': 'number',
|
|
49
|
+
'valuenow': 'number',
|
|
50
|
+
'valuetext': 'string',
|
|
57
51
|
};
|
|
58
52
|
|
|
59
53
|
exports.attributeStrongMapping = {
|
|
60
54
|
'disabled': 'disabled',
|
|
61
|
-
'hidden': 'hidden',
|
|
62
55
|
'placeholder': 'placeholder',
|
|
63
56
|
'readonly': 'readOnly',
|
|
64
57
|
'required': 'required',
|
|
@@ -73,209 +66,452 @@ exports.attributeWeakMapping = {
|
|
|
73
66
|
'selected': 'selected',
|
|
74
67
|
};
|
|
75
68
|
|
|
76
|
-
// https://www.w3.org/TR/html-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
'
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
69
|
+
// https://www.w3.org/TR/html-aam-1.0/#html-element-role-mappings
|
|
70
|
+
// https://www.w3.org/TR/wai-aria/roles
|
|
71
|
+
exports.roles = {
|
|
72
|
+
alert: {
|
|
73
|
+
childRoles: ['alertdialog'],
|
|
74
|
+
defaults: {
|
|
75
|
+
'live': 'assertive',
|
|
76
|
+
'atomic': true,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
article: {
|
|
80
|
+
selectors: ['article'],
|
|
81
|
+
},
|
|
82
|
+
button: {
|
|
83
|
+
selectors: [
|
|
84
|
+
'button',
|
|
85
|
+
'input[type="button"]',
|
|
86
|
+
'input[type="image"]',
|
|
87
|
+
'input[type="reset"]',
|
|
88
|
+
'input[type="submit"]',
|
|
89
|
+
'summary',
|
|
90
|
+
],
|
|
91
|
+
nameFromContents: true,
|
|
92
|
+
},
|
|
93
|
+
cell: {
|
|
94
|
+
selectors: ['td'],
|
|
95
|
+
childRoles: ['gridcell', 'rowheader'],
|
|
96
|
+
nameFromContents: true,
|
|
97
|
+
},
|
|
98
|
+
checkbox: {
|
|
99
|
+
selectors: ['input[type="checkbox"]'],
|
|
100
|
+
childRoles: ['menuitemcheckbox', 'switch'],
|
|
101
|
+
nameFromContents: true,
|
|
102
|
+
defaults: {
|
|
103
|
+
'checked': 'false',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
columnheader: {
|
|
107
|
+
selectors: ['th[scope="col"]'],
|
|
108
|
+
nameFromContents: true,
|
|
109
|
+
},
|
|
110
|
+
combobox: {
|
|
111
|
+
selectors: [
|
|
90
112
|
'input:not([type])[list]',
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
'select
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
'
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
113
|
+
'input[type="email"][list]',
|
|
114
|
+
'input[type="search"][list]',
|
|
115
|
+
'input[type="tel"][list]',
|
|
116
|
+
'input[type="text"][list]',
|
|
117
|
+
'input[type="url"][list]',
|
|
118
|
+
'select:not([size]):not([multiple])',
|
|
119
|
+
'select[size="0"]:not([multiple])',
|
|
120
|
+
'select[size="1"]:not([multiple])',
|
|
121
|
+
],
|
|
122
|
+
defaults: {
|
|
123
|
+
'expanded': false,
|
|
124
|
+
'haspopup': 'listbox',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
command: {
|
|
128
|
+
childRoles: ['button', 'link', 'menuitem'],
|
|
129
|
+
},
|
|
130
|
+
complementary: {
|
|
131
|
+
selectors: ['aside'],
|
|
132
|
+
},
|
|
133
|
+
composite: {
|
|
134
|
+
childRoles: ['grid', 'select', 'spinbutton', 'tablist'],
|
|
135
|
+
},
|
|
136
|
+
definition: {
|
|
137
|
+
selectors: ['dd'],
|
|
138
|
+
},
|
|
139
|
+
dialog: {
|
|
140
|
+
selectors: ['dialog'],
|
|
141
|
+
childRoles: ['alertdialog'],
|
|
142
|
+
},
|
|
143
|
+
'doc-backlink': {
|
|
144
|
+
nameFromContents: true,
|
|
145
|
+
},
|
|
146
|
+
'doc-biblioref': {
|
|
147
|
+
nameFromContents: true,
|
|
148
|
+
},
|
|
149
|
+
'doc-glossref': {
|
|
150
|
+
nameFromContents: true,
|
|
151
|
+
},
|
|
152
|
+
'doc-noteref': {
|
|
153
|
+
nameFromContents: true,
|
|
154
|
+
},
|
|
155
|
+
document: {
|
|
156
|
+
selectors: ['body'],
|
|
157
|
+
childRoles: ['article', 'graphics-document'],
|
|
158
|
+
},
|
|
159
|
+
figure: {
|
|
160
|
+
selectors: ['figure'],
|
|
161
|
+
},
|
|
162
|
+
form: {
|
|
163
|
+
selectors: ['form[aria-label]', 'form[aria-labelledby]', 'form[title]'],
|
|
164
|
+
},
|
|
165
|
+
grid: {
|
|
166
|
+
childRoles: ['treegrid'],
|
|
167
|
+
},
|
|
168
|
+
gridcell: {
|
|
169
|
+
childRoles: ['columnheader', 'rowheader'],
|
|
170
|
+
nameFromContents: true,
|
|
171
|
+
},
|
|
172
|
+
group: {
|
|
173
|
+
selectors: ['details', 'optgroup'],
|
|
174
|
+
childRoles: ['row', 'select', 'toolbar', 'graphics-object'],
|
|
175
|
+
},
|
|
176
|
+
heading: {
|
|
177
|
+
selectors: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
|
178
|
+
nameFromContents: true,
|
|
179
|
+
defaults: {
|
|
180
|
+
'level': 2,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
img: {
|
|
184
|
+
selectors: ['img:not([alt=""])', 'graphics-symbol'],
|
|
185
|
+
childRoles: ['doc-cover'],
|
|
186
|
+
},
|
|
187
|
+
input: {
|
|
188
|
+
childRoles: ['checkbox', 'option', 'radio', 'slider', 'spinbutton', 'textbox'],
|
|
189
|
+
},
|
|
190
|
+
landmark: {
|
|
191
|
+
childRoles: [
|
|
192
|
+
'banner',
|
|
193
|
+
'complementary',
|
|
194
|
+
'contentinfo',
|
|
195
|
+
'doc-acknowledgments',
|
|
196
|
+
'doc-afterword',
|
|
197
|
+
'doc-appendix',
|
|
198
|
+
'doc-bibliography',
|
|
199
|
+
'doc-chapter',
|
|
200
|
+
'doc-conclusion',
|
|
201
|
+
'doc-credits',
|
|
202
|
+
'doc-endnotes',
|
|
203
|
+
'doc-epilogue',
|
|
204
|
+
'doc-errata',
|
|
205
|
+
'doc-foreword',
|
|
206
|
+
'doc-glossary',
|
|
207
|
+
'doc-introduction',
|
|
208
|
+
'doc-part',
|
|
209
|
+
'doc-preface',
|
|
210
|
+
'doc-prologue',
|
|
211
|
+
'form',
|
|
212
|
+
'main',
|
|
213
|
+
'navigation',
|
|
214
|
+
'region',
|
|
215
|
+
'search',
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
link: {
|
|
219
|
+
selectors: ['a[href]', 'area[href]', 'link[href]'],
|
|
220
|
+
childRoles: ['doc-backlink', 'doc-biblioref', 'doc-glossref', 'doc-noteref'],
|
|
221
|
+
nameFromContents: true,
|
|
222
|
+
},
|
|
223
|
+
list: {
|
|
224
|
+
selectors: ['dl', 'ol', 'ul'],
|
|
225
|
+
childRoles: ['directory', 'feed'],
|
|
226
|
+
},
|
|
227
|
+
listbox: {
|
|
228
|
+
selectors: [
|
|
229
|
+
'select[multiple]',
|
|
230
|
+
'select[size]:not([size="0"]):not([size="1"])',
|
|
231
|
+
],
|
|
232
|
+
defaults: {
|
|
233
|
+
'orientation': 'vertical',
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
listitem: {
|
|
237
|
+
selectors: ['dt', 'ul > li', 'ol > li'],
|
|
238
|
+
childRoles: ['doc-biblioentry', 'doc-endnote', 'treeitem'],
|
|
239
|
+
},
|
|
240
|
+
log: {
|
|
241
|
+
defaults: {
|
|
242
|
+
'live': 'polite',
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
main: {
|
|
246
|
+
selectors: ['main'],
|
|
247
|
+
},
|
|
248
|
+
math: {
|
|
249
|
+
selectors: ['math'],
|
|
250
|
+
},
|
|
251
|
+
menu: {
|
|
252
|
+
selectors: ['menu[type="context"]'],
|
|
253
|
+
childRoles: ['menubar'],
|
|
254
|
+
defaults: {
|
|
255
|
+
'orientation': 'vertical',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
menubar: {
|
|
259
|
+
defaults: {
|
|
260
|
+
'orientation': 'horizontal',
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
menuitem: {
|
|
264
|
+
selectors: ['menuitem[type="command"]'],
|
|
265
|
+
childRoles: ['menuitemcheckbox'],
|
|
266
|
+
nameFromContents: true,
|
|
267
|
+
},
|
|
268
|
+
menuitemcheckbox: {
|
|
269
|
+
selectors: ['menuitem[type="checkbox"]'],
|
|
270
|
+
childRoles: ['menuitemradio'],
|
|
271
|
+
nameFromContents: true,
|
|
272
|
+
defaults: {
|
|
273
|
+
'checked': 'false',
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
menuitemradio: {
|
|
277
|
+
selectors: ['menuitem[type="radio"]'],
|
|
278
|
+
nameFromContents: true,
|
|
279
|
+
defaults: {
|
|
280
|
+
'checked': 'false',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
navigation: {
|
|
284
|
+
selectors: ['nav'],
|
|
285
|
+
childRoles: ['doc-index', 'doc-pagelist', 'doc-toc'],
|
|
286
|
+
},
|
|
287
|
+
note: {
|
|
288
|
+
childRoles: ['doc-notice', 'doc-tip'],
|
|
289
|
+
},
|
|
290
|
+
option: {
|
|
291
|
+
selectors: ['option'],
|
|
292
|
+
childRoles: ['treeitem'],
|
|
293
|
+
nameFromContents: true,
|
|
294
|
+
defaults: {
|
|
295
|
+
'selected': 'false',
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
progressbar: {
|
|
299
|
+
selectors: ['progress'],
|
|
300
|
+
},
|
|
301
|
+
radio: {
|
|
302
|
+
selectors: ['input[type="radio"]'],
|
|
303
|
+
childRoles: ['menuitemradio'],
|
|
304
|
+
nameFromContents: true,
|
|
305
|
+
defaults: {
|
|
306
|
+
'checked': 'false',
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
range: {
|
|
310
|
+
childRoles: ['progressbar', 'scrollbar', 'slider', 'spinbutton'],
|
|
311
|
+
},
|
|
312
|
+
region: {
|
|
313
|
+
selectors: ['section[aria-label]', 'section[aria-labelledby]', 'section[title]'],
|
|
314
|
+
},
|
|
315
|
+
roletype: {
|
|
316
|
+
childRoles: ['structure', 'widget', 'window'],
|
|
317
|
+
},
|
|
318
|
+
row: {
|
|
319
|
+
selectors: ['tr'],
|
|
320
|
+
nameFromContents: true,
|
|
321
|
+
},
|
|
322
|
+
rowgroup: {
|
|
323
|
+
selectors: ['tbody', 'thead', 'tfoot'],
|
|
324
|
+
nameFromContents: true,
|
|
325
|
+
},
|
|
326
|
+
rowheader: {
|
|
327
|
+
selectors: ['th[scope="row"]'],
|
|
328
|
+
nameFromContents: true,
|
|
329
|
+
},
|
|
330
|
+
scrollbar: {
|
|
331
|
+
defaults: {
|
|
332
|
+
'orientation': 'vertical',
|
|
333
|
+
'valuemin': 0,
|
|
334
|
+
'valuemax': 100,
|
|
335
|
+
// FIXME: halfway between actual valuemin and valuemax
|
|
336
|
+
'valuenow': 50,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
searchbox: {
|
|
340
|
+
selectors: ['input[type="search"]:not([list])'],
|
|
341
|
+
},
|
|
342
|
+
section: {
|
|
343
|
+
childRoles: [
|
|
344
|
+
'alert',
|
|
345
|
+
'cell',
|
|
346
|
+
'definition',
|
|
347
|
+
'doc-abstract',
|
|
348
|
+
'doc-colophon',
|
|
349
|
+
'doc-credit',
|
|
350
|
+
'doc-dedication',
|
|
351
|
+
'doc-epigraph',
|
|
352
|
+
'doc-example',
|
|
353
|
+
'doc-footnote',
|
|
354
|
+
'doc-qna',
|
|
355
|
+
'figure',
|
|
356
|
+
'group',
|
|
357
|
+
'img',
|
|
358
|
+
'landmark',
|
|
359
|
+
'list',
|
|
360
|
+
'listitem',
|
|
361
|
+
'log',
|
|
362
|
+
'marquee',
|
|
363
|
+
'math',
|
|
364
|
+
'note',
|
|
365
|
+
'status',
|
|
366
|
+
'table',
|
|
367
|
+
'tabpanel',
|
|
368
|
+
'term',
|
|
369
|
+
'tooltip',
|
|
370
|
+
],
|
|
371
|
+
},
|
|
372
|
+
sectionhead: {
|
|
373
|
+
childRoles: [
|
|
374
|
+
'columnheader',
|
|
375
|
+
'doc-subtitle',
|
|
376
|
+
'heading',
|
|
377
|
+
'rowheader',
|
|
378
|
+
'tab',
|
|
379
|
+
],
|
|
380
|
+
nameFromContents: true,
|
|
381
|
+
},
|
|
382
|
+
select: {
|
|
383
|
+
childRoles: ['combobox', 'listbox', 'menu', 'radiogroup', 'tree'],
|
|
384
|
+
},
|
|
385
|
+
separator: {
|
|
386
|
+
// assume not focussable because <hr> is not
|
|
387
|
+
selectors: ['hr'],
|
|
388
|
+
childRoles: ['doc-pagebreak'],
|
|
389
|
+
defaults: {
|
|
390
|
+
'orientation': 'horizontal',
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
slider: {
|
|
394
|
+
selectors: ['input[type="range"]'],
|
|
395
|
+
defaults: {
|
|
396
|
+
'orientation': 'horizontal',
|
|
397
|
+
'valuemin': 0,
|
|
398
|
+
'valuemax': 100,
|
|
399
|
+
// FIXME: halfway between actual valuemin and valuemax
|
|
400
|
+
'valuenow': 50,
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
spinbutton: {
|
|
404
|
+
selectors: ['input[type="number"]'],
|
|
405
|
+
defaults: {
|
|
406
|
+
// FIXME: no valuemin/valuemax
|
|
407
|
+
'valuenow': 0,
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
status: {
|
|
411
|
+
selectors: ['output'],
|
|
412
|
+
childRoles: ['timer'],
|
|
413
|
+
defaults: {
|
|
414
|
+
'live': 'polite',
|
|
415
|
+
'atomic': true,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
structure: {
|
|
419
|
+
childRoles: [
|
|
420
|
+
'application',
|
|
421
|
+
'document',
|
|
422
|
+
'none',
|
|
423
|
+
'presentation',
|
|
424
|
+
'rowgroup',
|
|
425
|
+
'section',
|
|
426
|
+
'sectionhead',
|
|
427
|
+
'separator',
|
|
428
|
+
],
|
|
429
|
+
},
|
|
430
|
+
switch: {
|
|
431
|
+
nameFromContents: true,
|
|
432
|
+
defaults: {
|
|
433
|
+
'checked': false,
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
tab: {
|
|
437
|
+
nameFromContents: true,
|
|
438
|
+
defaults: {
|
|
439
|
+
'selected': false,
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
table: {
|
|
443
|
+
selectors: ['table'],
|
|
444
|
+
childRoles: ['grid'],
|
|
445
|
+
},
|
|
446
|
+
tablist: {
|
|
447
|
+
defaults: {
|
|
448
|
+
'orientation': 'horizontal',
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
term: {
|
|
452
|
+
selectors: ['dfn', 'dt'],
|
|
453
|
+
},
|
|
454
|
+
textbox: {
|
|
455
|
+
selectors: [
|
|
456
|
+
'input:not([type]):not([list])',
|
|
457
|
+
'input[type="email"]:not([list])',
|
|
458
|
+
'input[type="tel"]:not([list])',
|
|
459
|
+
'input[type="text"]:not([list])',
|
|
460
|
+
'input[type="url"]:not([list])',
|
|
461
|
+
'textarea',
|
|
462
|
+
],
|
|
463
|
+
childRoles: ['searchbox'],
|
|
464
|
+
},
|
|
465
|
+
toolbar: {
|
|
466
|
+
defaults: {
|
|
467
|
+
'orientation': 'horizontal',
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
tooltip: {
|
|
471
|
+
nameFromContents: true,
|
|
472
|
+
},
|
|
473
|
+
tree: {
|
|
474
|
+
childRoles: ['treegrid'],
|
|
475
|
+
defaults: {
|
|
476
|
+
'orientation': 'vertical',
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
treeitem: {
|
|
480
|
+
nameFromContents: true,
|
|
481
|
+
},
|
|
482
|
+
widget: {
|
|
483
|
+
childRoles: [
|
|
484
|
+
'command',
|
|
485
|
+
'composite',
|
|
486
|
+
'gridcell',
|
|
487
|
+
'input',
|
|
488
|
+
'range',
|
|
489
|
+
'row',
|
|
490
|
+
'tab',
|
|
491
|
+
],
|
|
492
|
+
},
|
|
493
|
+
window: {
|
|
494
|
+
childRoles: ['dialog'],
|
|
495
|
+
},
|
|
148
496
|
};
|
|
149
497
|
|
|
150
498
|
exports.scoped = [
|
|
151
|
-
'
|
|
499
|
+
'main *',
|
|
500
|
+
// https://www.w3.org/TR/html/dom.html#sectioning-content-2
|
|
501
|
+
'article *', 'aside *', 'nav *', 'section *',
|
|
502
|
+
// https://www.w3.org/TR/html/sections.html#sectioning-roots
|
|
503
|
+
'blockquote *', 'details *', 'dialog *', 'fieldset *', 'figure *', 'td *',
|
|
152
504
|
].join(',');
|
|
153
505
|
|
|
154
|
-
// https://www.w3.org/TR/wai-aria/roles
|
|
155
|
-
var subRoles = {
|
|
156
|
-
cell: ['gridcell', 'rowheader'],
|
|
157
|
-
command: ['button', 'link', 'menuitem'],
|
|
158
|
-
composite: ['grid', 'select', 'spinbutton', 'tablist'],
|
|
159
|
-
img: ['doc-cover'],
|
|
160
|
-
input: ['checkbox', 'option', 'radio', 'slider', 'spinbutton', 'textbox'],
|
|
161
|
-
landmark: [
|
|
162
|
-
'banner',
|
|
163
|
-
'complementary',
|
|
164
|
-
'contentinfo',
|
|
165
|
-
'doc-acknowledgments',
|
|
166
|
-
'doc-afterword',
|
|
167
|
-
'doc-appendix',
|
|
168
|
-
'doc-bibliography',
|
|
169
|
-
'doc-chapter',
|
|
170
|
-
'doc-conclusion',
|
|
171
|
-
'doc-credits',
|
|
172
|
-
'doc-endnotes',
|
|
173
|
-
'doc-epilogue',
|
|
174
|
-
'doc-errata',
|
|
175
|
-
'doc-foreword',
|
|
176
|
-
'doc-glossary',
|
|
177
|
-
'doc-introduction',
|
|
178
|
-
'doc-part',
|
|
179
|
-
'doc-preface',
|
|
180
|
-
'doc-prologue',
|
|
181
|
-
'form',
|
|
182
|
-
'main',
|
|
183
|
-
'navigation',
|
|
184
|
-
'region',
|
|
185
|
-
'search',
|
|
186
|
-
],
|
|
187
|
-
range: ['progressbar', 'scrollbar', 'slider', 'spinbutton'],
|
|
188
|
-
roletype: ['structure', 'widget', 'window'],
|
|
189
|
-
section: [
|
|
190
|
-
'alert',
|
|
191
|
-
'cell',
|
|
192
|
-
'definition',
|
|
193
|
-
'doc-abstract',
|
|
194
|
-
'doc-colophon',
|
|
195
|
-
'doc-credit',
|
|
196
|
-
'doc-dedication',
|
|
197
|
-
'doc-epigraph',
|
|
198
|
-
'doc-example',
|
|
199
|
-
'doc-footnote',
|
|
200
|
-
'doc-qna',
|
|
201
|
-
'figure',
|
|
202
|
-
'group',
|
|
203
|
-
'img',
|
|
204
|
-
'landmark',
|
|
205
|
-
'list',
|
|
206
|
-
'listitem',
|
|
207
|
-
'log',
|
|
208
|
-
'marquee',
|
|
209
|
-
'math',
|
|
210
|
-
'note',
|
|
211
|
-
'status',
|
|
212
|
-
'table',
|
|
213
|
-
'tabpanel',
|
|
214
|
-
'term',
|
|
215
|
-
'tooltip',
|
|
216
|
-
],
|
|
217
|
-
sectionhead: [
|
|
218
|
-
'columnheader',
|
|
219
|
-
'doc-subtitle',
|
|
220
|
-
'heading',
|
|
221
|
-
'rowheader',
|
|
222
|
-
'tab',
|
|
223
|
-
],
|
|
224
|
-
select: ['combobox', 'listbox', 'menu', 'radiogroup', 'tree'],
|
|
225
|
-
separator: ['doc-pagebreak'],
|
|
226
|
-
structure: [
|
|
227
|
-
'application',
|
|
228
|
-
'document',
|
|
229
|
-
'none',
|
|
230
|
-
'presentation',
|
|
231
|
-
'rowgroup',
|
|
232
|
-
'section',
|
|
233
|
-
'sectionhead',
|
|
234
|
-
'separator',
|
|
235
|
-
],
|
|
236
|
-
table: ['grid'],
|
|
237
|
-
textbox: ['searchbox'],
|
|
238
|
-
widget: [
|
|
239
|
-
'command',
|
|
240
|
-
'composite',
|
|
241
|
-
'gridcell',
|
|
242
|
-
'input',
|
|
243
|
-
'range',
|
|
244
|
-
'row',
|
|
245
|
-
'separator',
|
|
246
|
-
'tab',
|
|
247
|
-
],
|
|
248
|
-
window: ['dialog'],
|
|
249
|
-
alert: ['alertdialog'],
|
|
250
|
-
checkbox: ['menuitemcheckbox', 'switch'],
|
|
251
|
-
dialog: ['alertdialog'],
|
|
252
|
-
gridcell: ['columnheader', 'rowheader'],
|
|
253
|
-
menuitem: ['menuitemcheckbox'],
|
|
254
|
-
menuitemcheckbox: ['menuitemradio'],
|
|
255
|
-
option: ['treeitem'],
|
|
256
|
-
radio: ['menuitemradio'],
|
|
257
|
-
status: ['timer'],
|
|
258
|
-
grid: ['treegrid'],
|
|
259
|
-
menu: ['menubar'],
|
|
260
|
-
tree: ['treegrid'],
|
|
261
|
-
document: ['article', 'graphics-document'],
|
|
262
|
-
group: ['row', 'select', 'toolbar', 'graphics-object'],
|
|
263
|
-
link: ['doc-backlink', 'doc-biblioref', 'doc-glossref', 'doc-noteref'],
|
|
264
|
-
list: ['directory', 'feed'],
|
|
265
|
-
listitem: ['doc-biblioentry', 'doc-endnote', 'treeitem'],
|
|
266
|
-
navigation: ['doc-index', 'doc-pagelist', 'doc-toc'],
|
|
267
|
-
note: ['doc-notice', 'doc-tip'],
|
|
268
|
-
};
|
|
269
|
-
|
|
270
506
|
var getSubRoles = function(role) {
|
|
271
|
-
var children =
|
|
507
|
+
var children = (exports.roles[role] || {}).childRoles || [];
|
|
272
508
|
var descendents = children.map(getSubRoles);
|
|
273
509
|
|
|
274
510
|
var result = [role];
|
|
275
511
|
|
|
276
512
|
descendents.forEach(function(list) {
|
|
277
513
|
list.forEach(function(r) {
|
|
278
|
-
if (result.
|
|
514
|
+
if (!result.includes(r)) {
|
|
279
515
|
result.push(r);
|
|
280
516
|
}
|
|
281
517
|
});
|
|
@@ -284,38 +520,20 @@ var getSubRoles = function(role) {
|
|
|
284
520
|
return result;
|
|
285
521
|
};
|
|
286
522
|
|
|
287
|
-
exports.
|
|
288
|
-
for (var role in subRoles) {
|
|
289
|
-
exports.subRoles[role] = getSubRoles(role);
|
|
290
|
-
}
|
|
291
|
-
exports.subRoles['none'] = ['none', 'presentation'];
|
|
292
|
-
exports.subRoles['presentation'] = ['presentation', 'none'];
|
|
523
|
+
exports.attrsWithDefaults = [];
|
|
293
524
|
|
|
294
|
-
exports.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
'menuitemcheckbox',
|
|
307
|
-
'menuitemradio',
|
|
308
|
-
'option',
|
|
309
|
-
'radio',
|
|
310
|
-
'row',
|
|
311
|
-
'rowgroup',
|
|
312
|
-
'rowheader',
|
|
313
|
-
'sectionhead',
|
|
314
|
-
'tab',
|
|
315
|
-
'tooltip',
|
|
316
|
-
'treeitem',
|
|
317
|
-
'switch',
|
|
318
|
-
];
|
|
525
|
+
for (var role in exports.roles) {
|
|
526
|
+
exports.roles[role].subRoles = getSubRoles(role);
|
|
527
|
+
for (var key in exports.roles[role].defaults) {
|
|
528
|
+
if (!exports.attrsWithDefaults.includes(key)) {
|
|
529
|
+
exports.attrsWithDefaults.push(key);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
exports.roles['none'] = exports.roles['none'] || {};
|
|
534
|
+
exports.roles['none'].subRoles = ['none', 'presentation'];
|
|
535
|
+
exports.roles['presentation'] = exports.roles['presentation'] || {};
|
|
536
|
+
exports.roles['presentation'].subRoles = ['presentation', 'none'];
|
|
319
537
|
|
|
320
538
|
exports.nameFromDescendant = {
|
|
321
539
|
'figure': 'figcaption',
|