1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
|
<html>
<head>
<title>Group attributes tests</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../attributes.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// HTML select with no size attribute.
testGroupAttrs("opt1-nosize", 1, 4);
testGroupAttrs("opt2-nosize", 2, 4);
testGroupAttrs("opt3-nosize", 3, 4);
testGroupAttrs("opt4-nosize", 4, 4);
// Container should have item count and not hierarchical
testGroupParentAttrs(getAccessible("opt1-nosize").parent, 4, false);
// ////////////////////////////////////////////////////////////////////////
// HTML select
testGroupAttrs("opt1", 1, 2);
testGroupAttrs("opt2", 2, 2);
// ////////////////////////////////////////////////////////////////////////
// HTML select with optgroup
testGroupAttrs("select2_opt3", 1, 2, 1);
testGroupAttrs("select2_opt4", 2, 2, 1);
testGroupAttrs("select2_opt1", 1, 2, 2);
testGroupAttrs("select2_opt2", 2, 2, 2);
// ////////////////////////////////////////////////////////////////////////
// HTML input@type="radio" within form
testGroupAttrs("radio1", 1, 2);
testGroupAttrs("radio2", 2, 2);
// ////////////////////////////////////////////////////////////////////////
// HTML input@type="radio" within document
testGroupAttrs("radio3", 1, 2);
testGroupAttrs("radio4", 2, 2);
// ////////////////////////////////////////////////////////////////////////
// Hidden HTML input@type="radio"
testGroupAttrs("radio5", 1, 1);
// ////////////////////////////////////////////////////////////////////////
// HTML ul/ol
testGroupAttrs("li1", 1, 3);
testGroupAttrs("li2", 2, 3);
testGroupAttrs("li3", 3, 3);
// ul should have item count and not hierarchical
testGroupParentAttrs("ul", 3, false);
// ////////////////////////////////////////////////////////////////////////
// HTML ul/ol (nested lists)
testGroupAttrs("li4", 1, 3, 1);
testGroupAttrs("li5", 2, 3, 1);
testGroupAttrs("li6", 3, 3, 1);
// ol with nested list should have 1st level item count and be hierarchical
testGroupParentAttrs("ol", 3, true);
testGroupAttrs("n_li4", 1, 3, 2);
testGroupAttrs("n_li5", 2, 3, 2);
testGroupAttrs("n_li6", 3, 3, 2);
// nested ol should have item count and be hierarchical
testGroupParentAttrs("ol_nested", 3, true);
// ////////////////////////////////////////////////////////////////////////
// ARIA list
testGroupAttrs("li7", 1, 3);
testGroupAttrs("li8", 2, 3);
testGroupAttrs("li9", 3, 3);
// simple flat aria list
testGroupParentAttrs("aria-list_1", 3, false);
// ////////////////////////////////////////////////////////////////////////
// ARIA list (nested lists: list -> listitem -> list -> listitem)
testGroupAttrs("li10", 1, 3, 1);
testGroupAttrs("li11", 2, 3, 1);
testGroupAttrs("li12", 3, 3, 1);
// aria list with nested list
testGroupParentAttrs("aria-list_2", 3, true);
testGroupAttrs("n_li10", 1, 3, 2);
testGroupAttrs("n_li11", 2, 3, 2);
testGroupAttrs("n_li12", 3, 3, 2);
// nested aria list.
testGroupParentAttrs("aria-list_2_1", 3, true);
// ////////////////////////////////////////////////////////////////////////
// ARIA list (nested lists: list -> listitem -> group -> listitem)
testGroupAttrs("lgt_li1", 1, 2, 1);
testGroupAttrs("lgt_li1_nli1", 1, 2, 2);
testGroupAttrs("lgt_li1_nli2", 2, 2, 2);
testGroupAttrs("lgt_li2", 2, 2, 1);
testGroupAttrs("lgt_li2_nli1", 1, 2, 2);
testGroupAttrs("lgt_li2_nli2", 2, 2, 2);
// aria list with nested list
testGroupParentAttrs("aria-list_3", 2, true);
// ////////////////////////////////////////////////////////////////////////
// ARIA menu (menuitem, separator, menuitemradio and menuitemcheckbox)
testGroupAttrs("menu_item1", 1, 2);
testGroupAttrs("menu_item2", 2, 2);
testGroupAttrs("menu_item1.1", 1, 2);
testGroupAttrs("menu_item1.2", 2, 2);
testGroupAttrs("menu_item1.3", 1, 3);
testGroupAttrs("menu_item1.4", 2, 3);
testGroupAttrs("menu_item1.5", 3, 3);
// menu bar item count
testGroupParentAttrs("menubar", 2, false);
// Bug 1492529. Menu should have total number of items 5 from both sets,
// but only has the first 2 item set.
todoAttr("menu", "child-item-count", "5");
// ////////////////////////////////////////////////////////////////////////
// ARIA tab
testGroupAttrs("tab_1", 1, 3);
testGroupAttrs("tab_2", 2, 3);
testGroupAttrs("tab_3", 3, 3);
// tab list tab count
testGroupParentAttrs("tablist_1", 3, false);
// ////////////////////////////////////////////////////////////////////////
// ARIA radio
testGroupAttrs("r1", 1, 3);
testGroupAttrs("r2", 2, 3);
testGroupAttrs("r3", 3, 3);
// explicit aria radio group
testGroupParentAttrs("rg1", 3, false);
// ////////////////////////////////////////////////////////////////////////
// ARIA tree
testGroupAttrs("ti1", 1, 3, 1);
testGroupAttrs("ti2", 1, 2, 2);
testGroupAttrs("ti3", 2, 2, 2);
testGroupAttrs("ti4", 2, 3, 1);
testGroupAttrs("ti5", 1, 3, 2);
testGroupAttrs("ti6", 2, 3, 2);
testGroupAttrs("ti7", 3, 3, 2);
testGroupAttrs("ti8", 3, 3, 1);
testGroupParentAttrs("tree_1", 3, true);
// ////////////////////////////////////////////////////////////////////////
// ARIA tree (tree -> treeitem -> group -> treeitem)
testGroupAttrs("tree2_ti1", 1, 2, 1);
testGroupAttrs("tree2_ti1a", 1, 2, 2);
testGroupAttrs("tree2_ti1b", 2, 2, 2);
testGroupAttrs("tree2_ti2", 2, 2, 1);
testGroupAttrs("tree2_ti2a", 1, 2, 2);
testGroupAttrs("tree2_ti2b", 2, 2, 2);
testGroupParentAttrs("tree_2", 2, true);
// ////////////////////////////////////////////////////////////////////////
// ARIA tree (tree -> treeitem, group -> treeitem)
testGroupAttrs("tree3_ti1", 1, 2, 1);
testGroupAttrs("tree3_ti1a", 1, 2, 2);
testGroupAttrs("tree3_ti1b", 2, 2, 2);
testGroupAttrs("tree3_ti2", 2, 2, 1);
testGroupAttrs("tree3_ti2a", 1, 2, 2);
testGroupAttrs("tree3_ti2b", 2, 2, 2);
testGroupParentAttrs("tree_3", 2, true);
// ////////////////////////////////////////////////////////////////////////
// ARIA grid
testGroupAttrs("grid_row1", 1, 2);
testAbsentAttrs("grid_cell1", {"posinset": "", "setsize": ""});
testAbsentAttrs("grid_cell2", {"posinset": "", "setsize": ""});
testGroupAttrs("grid_row2", 2, 2);
testAbsentAttrs("grid_cell3", {"posinset": "", "setsize": ""});
testAbsentAttrs("grid_cell4", {"posinset": "", "setsize": ""});
testGroupParentAttrs("grid", 2, false);
// ////////////////////////////////////////////////////////////////////////
// ARIA treegrid
testGroupAttrs("treegrid_row1", 1, 2, 1);
testAbsentAttrs("treegrid_cell1", {"posinset": "", "setsize": ""});
testAbsentAttrs("treegrid_cell2", {"posinset": "", "setsize": ""});
testGroupAttrs("treegrid_row2", 1, 1, 2);
testAbsentAttrs("treegrid_cell3", {"posinset": "", "setsize": ""});
testAbsentAttrs("treegrid_cell4", {"posinset": "", "setsize": ""});
testGroupAttrs("treegrid_row3", 2, 2, 1);
testAbsentAttrs("treegrid_cell5", {"posinset": "", "setsize": ""});
testAbsentAttrs("treegrid_cell6", {"posinset": "", "setsize": ""});
testGroupParentAttrs("treegrid", 2, true);
// row child item count provided by parent grid's aria-colcount
testGroupParentAttrs("treegrid_row1", 4, false);
// ////////////////////////////////////////////////////////////////////////
// HTML headings
testGroupAttrs("h1", 0, 0, 1);
testGroupAttrs("h2", 0, 0, 2);
testGroupAttrs("h3", 0, 0, 3);
testGroupAttrs("h4", 0, 0, 4);
testGroupAttrs("h5", 0, 0, 5);
testGroupAttrs("h6", 0, 0, 6);
testGroupAttrs("ariaHeadingNoLevel", 0, 0, 2);
// No child item counts or "tree" flag for parent of headings
testAbsentAttrs("headings", {"child-item-count": "", "tree": ""});
// ////////////////////////////////////////////////////////////////////////
// ARIA combobox
testGroupAttrs("combo1_opt1", 1, 4);
testGroupAttrs("combo1_opt2", 2, 4);
testGroupAttrs("combo1_opt3", 3, 4);
testGroupAttrs("combo1_opt4", 4, 4);
testGroupParentAttrs("combo1", 4, false);
// ////////////////////////////////////////////////////////////////////////
// ARIA table
testGroupAttrs("table_cell", 3, 4);
testGroupAttrs("table_row", 2, 2);
// grid child item count provided by aria-rowcount
testGroupParentAttrs("table", 2, false);
// row child item count provided by parent grid's aria-colcount
testGroupParentAttrs("table_row", 4, false);
// Attributes calculated even when row is wrapped in a div.
testGroupAttrs("wrapped_row_1", 1, 2);
testGroupAttrs("wrapped_row_2", 2, 2);
// ////////////////////////////////////////////////////////////////////////
// ARIA list constructed by ARIA owns
testGroupAttrs("t1_li1", 1, 3);
testGroupAttrs("t1_li2", 2, 3);
testGroupAttrs("t1_li3", 3, 3);
testGroupParentAttrs("aria-list_4", 3, false);
// Test group attributes of ARIA comments
testGroupAttrs("comm_single_1", 1, 2, 1);
testGroupAttrs("comm_single_2", 2, 2, 1);
testGroupAttrs("comm_nested_1", 1, 3, 1);
testGroupAttrs("comm_nested_1_1", 1, 2, 2);
testGroupAttrs("comm_nested_1_2", 2, 2, 2);
testGroupAttrs("comm_nested_2", 2, 3, 1);
testGroupAttrs("comm_nested_2_1", 1, 1, 2);
testGroupAttrs("comm_nested_2_1_1", 1, 1, 3);
testGroupAttrs("comm_nested_3", 3, 3, 1);
// Test that group position information updates after deleting node.
testGroupAttrs("tree4_ti1", 1, 2, 1);
testGroupAttrs("tree4_ti2", 2, 2, 1);
testGroupParentAttrs("tree4", 2, true);
var tree4element = document.getElementById("tree4_ti1");
var tree4acc = getAccessible("tree4");
tree4element.remove();
waitForEvent(EVENT_REORDER, tree4acc, function() {
testGroupAttrs("tree4_ti2", 1, 1, 1);
testGroupParentAttrs("tree4", 1, true);
SimpleTest.finish();
});
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=468418"
title="Expose level for nested lists in HTML">
Mozilla Bug 468418
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=844023"
title="group info might not be properly updated when flat trees mutate">
Bug 844023
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=864224"
title="Support nested ARIA listitems structured by role='group'">
Bug 864224
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=907682"
title=" HTML:option group position is not correct when select is collapsed">
Mozilla Bug 907682
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<select>
<option id="opt1-nosize">option1</option>
<option id="opt2-nosize">option2</option>
<option id="opt3-nosize">option3</option>
<option id="opt4-nosize">option4</option>
</select>
<select size="4">
<option id="opt1">option1</option>
<option id="opt2">option2</option>
</select>
<select size="4">
<optgroup id="select2_optgroup" label="group">
<option id="select2_opt1">option1</option>
<option id="select2_opt2">option2</option>
</optgroup>
<option id="select2_opt3">option3</option>
<option id="select2_opt4">option4</option>
</select>
<form>
<input type="radio" id="radio1" name="group1"/>
<input type="radio" id="radio2" name="group1"/>
</form>
<input type="radio" id="radio3" name="group2"/>
<input type="radio" id="radio4" name="group2"/>
<ul id="ul">
<li id="li1">Oranges</li>
<li id="li2">Apples</li>
<li id="li3">Bananas</li>
</ul>
<ol id="ol">
<li id="li4">Oranges</li>
<li id="li5">Apples</li>
<li id="li6">Bananas
<ul id="ol_nested">
<li id="n_li4">Oranges</li>
<li id="n_li5">Apples</li>
<li id="n_li6">Bananas</li>
</ul>
</li>
</ol>
<span role="list" id="aria-list_1">
<span role="listitem" id="li7">Oranges</span>
<span role="listitem" id="li8">Apples</span>
<span role="listitem" id="li9">Bananas</span>
</span>
<span role="list" id="aria-list_2">
<span role="listitem" id="li10">Oranges</span>
<span role="listitem" id="li11">Apples</span>
<span role="listitem" id="li12">Bananas
<span role="list" id="aria-list_2_1">
<span role="listitem" id="n_li10">Oranges</span>
<span role="listitem" id="n_li11">Apples</span>
<span role="listitem" id="n_li12">Bananas</span>
</span>
</span>
</span>
<div role="list" id="aria-list_3">
<div role="listitem" id="lgt_li1">Item 1
<div role="group">
<div role="listitem" id="lgt_li1_nli1">Item 1A</div>
<div role="listitem" id="lgt_li1_nli2">Item 1B</div>
</div>
</div>
<div role="listitem" id="lgt_li2">Item 2
<div role="group">
<div role="listitem" id="lgt_li2_nli1">Item 2A</div>
<div role="listitem" id="lgt_li2_nli2">Item 2B</div>
</div>
</div>
</div>
<ul role="menubar" id="menubar">
<li role="menuitem" aria-haspopup="true" id="menu_item1">File
<ul role="menu" id="menu">
<li role="menuitem" id="menu_item1.1">New</li>
<li role="menuitem" id="menu_item1.2">Open…</li>
<li role="separator">-----</li>
<li role="menuitem" id="menu_item1.3">Item</li>
<li role="menuitemradio" id="menu_item1.4">Radio</li>
<li role="menuitemcheckbox" id="menu_item1.5">Checkbox</li>
</ul>
</li>
<li role="menuitem" aria-haspopup="false" id="menu_item2">Help</li>
</ul>
<ul id="tablist_1" role="tablist">
<li id="tab_1" role="tab">Crust</li>
<li id="tab_2" role="tab">Veges</li>
<li id="tab_3" role="tab">Carnivore</li>
</ul>
<ul id="rg1" role="radiogroup">
<li id="r1" role="radio" aria-checked="false">Thai</li>
<li id="r2" role="radio" aria-checked="false">Subway</li>
<li id="r3" role="radio" aria-checked="false">Jimmy Johns</li>
</ul>
<table role="tree" id="tree_1">
<tr role="presentation">
<td role="treeitem" aria-expanded="true" aria-level="1"
id="ti1">vegetables</td>
</tr>
<tr role="presentation">
<td role="treeitem" aria-level="2" id="ti2">cucumber</td>
</tr>
<tr role="presentation">
<td role="treeitem" aria-level="2" id="ti3">carrot</td>
</tr>
<tr role="presentation">
<td role="treeitem" aria-expanded="false" aria-level="1"
id="ti4">cars</td>
</tr>
<tr role="presentation">
<td role="treeitem" aria-level="2" id="ti5">mercedes</td>
</tr>
<tr role="presentation">
<td role="treeitem" aria-level="2" id="ti6">BMW</td>
</tr>
<tr role="presentation">
<td role="treeitem" aria-level="2" id="ti7">Audi</td>
</tr>
<tr role="presentation">
<td role="treeitem" aria-level="1" id="ti8">people</td>
</tr>
</table>
<ul role="tree" id="tree_2">
<li role="treeitem" id="tree2_ti1">Item 1
<ul role="group">
<li role="treeitem" id="tree2_ti1a">Item 1A</li>
<li role="treeitem" id="tree2_ti1b">Item 1B</li>
</ul>
</li>
<li role="treeitem" id="tree2_ti2">Item 2
<ul role="group">
<li role="treeitem" id="tree2_ti2a">Item 2A</li>
<li role="treeitem" id="tree2_ti2b">Item 2B</li>
</ul>
</li>
</div>
<div role="tree" id="tree_3">
<div role="treeitem" id="tree3_ti1">Item 1</div>
<div role="group">
<li role="treeitem" id="tree3_ti1a">Item 1A</li>
<li role="treeitem" id="tree3_ti1b">Item 1B</li>
</div>
<div role="treeitem" id="tree3_ti2">Item 2</div>
<div role="group">
<div role="treeitem" id="tree3_ti2a">Item 2A</div>
<div role="treeitem" id="tree3_ti2b">Item 2B</div>
</div>
</div>
<!-- IMPORTANT: Need to have no whitespace between elements in this tree. -->
<div role="tree" id="tree4"><div role="treeitem"
id="tree4_ti1">Item 1</div><div role="treeitem"
id="tree4_ti2">Item 2</div></div>
<table role="grid" id="grid">
<tr role="row" id="grid_row1">
<td role="gridcell" id="grid_cell1">cell1</td>
<td role="gridcell" id="grid_cell2">cell2</td>
</tr>
<tr role="row" id="grid_row2">
<td role="gridcell" id="grid_cell3">cell3</td>
<td role="gridcell" id="grid_cell4">cell4</td>
</tr>
</table>
<div role="treegrid" id="treegrid" aria-colcount="4">
<div role="row" aria-level="1" id="treegrid_row1">
<div role="gridcell" id="treegrid_cell1">cell1</div>
<div role="gridcell" id="treegrid_cell2">cell2</div>
</div>
<div role="row" aria-level="2" id="treegrid_row2">
<div role="gridcell" id="treegrid_cell3">cell1</div>
<div role="gridcell" id="treegrid_cell4">cell2</div>
</div>
<div role="row" id="treegrid_row3">
<div role="gridcell" id="treegrid_cell5">cell1</div>
<div role="gridcell" id="treegrid_cell6">cell2</div>
</div>
</div>
<div id="headings">
<h1 id="h1">heading1</h1>
<h2 id="h2">heading2</h2>
<h3 id="h3">heading3</h3>
<h4 id="h4">heading4</h4>
<h5 id="h5">heading5</h5>
<h6 id="h6">heading6</h6>
<div id="ariaHeadingNoLevel" role="heading">ariaHeadingNoLevel</div>
</div>
<ul id="combo1" role="combobox">Password
<li id="combo1_opt1" role="option">Xyzzy</li>
<li id="combo1_opt2" role="option">Plughs</li>
<li id="combo1_opt3" role="option">Shazaam</li>
<li id="combo1_opt4" role="option">JoeSentMe</li>
</ul>
<form>
<input type="radio" style="display: none;" name="group3">
<input type="radio" id="radio5" name="group3">
</form>
<div role="table" aria-colcount="4" aria-rowcount="2" id="table">
<div role="row" id="table_row" aria-rowindex="2">
<div role="cell" id="table_cell" aria-colindex="3">cell</div>
</div>
</div>
<div role="grid" aria-readonly="true">
<div tabindex="-1">
<div role="row" id="wrapped_row_1">
<div role="gridcell">cell content</div>
</div>
</div>
<div tabindex="-1">
<div role="row" id="wrapped_row_2">
<div role="gridcell">cell content</div>
</div>
</div>
</div>
<div role="list" aria-owns="t1_li1 t1_li2 t1_li3" id="aria-list_4">
<div role="listitem" id="t1_li2">Apples</div>
<div role="listitem" id="t1_li1">Oranges</div>
</div>
<div role="listitem" id="t1_li3">Bananas</div>
<!-- ARIA comments, 1 level, group pos and size calculation -->
<article>
<p id="comm_single_1" role="comment">Comment 1</p>
<p id="comm_single_2" role="comment">Comment 2</p>
</article>
<!-- Nested comments -->
<article>
<div id="comm_nested_1" role="comment"><p>Comment 1 level 1</p>
<div id="comm_nested_1_1" role="comment"><p>Comment 1 level 2</p></div>
<div id="comm_nested_1_2" role="comment"><p>Comment 2 level 2</p></div>
</div>
<div id="comm_nested_2" role="comment"><p>Comment 2 level 1</p>
<div id="comm_nested_2_1" role="comment"><p>Comment 3 level 2</p>
<div id="comm_nested_2_1_1" role="comment"><p>Comment 1 level 3</p></div>
</div>
</div>
<div id="comm_nested_3" role="comment"><p>Comment 3 level 1</p></div>
</article>
</body>
</html>
|