4 <script src=
"../resources/js-test.js"></script>
6 <div id=
"myContainer" tabindex=
"-1">
8 <button>Button
</button>
10 <input type=
"checkbox">
13 <select><option>1<option>2</select>
14 <span tabindex=
"0" role=
"button">ARIA button
</span>
15 <span tabindex=
"0" role=
"link">ARIA link
</span>
18 <canvas id=
"myCanvas" width=
"300" height=
"300" tabindex=
"-1">
20 <button>Button
</button>
22 <input type=
"checkbox">
25 <select><option>1<option>2</select>
26 <span tabindex=
"0" role=
"button">ARIA button
</span>
27 <span tabindex=
"0" role=
"link">ARIA link
</span>
30 <div id=
"console"></div>
32 description("This test makes sure that AccessibilityNodeObjects are created for elements in a canvas subtree.");
34 if (window
.testRunner
&& window
.accessibilityController
) {
35 window
.testRunner
.dumpAsText();
37 function appendFocusableDescendants(axObject
, axFocusableList
) {
38 for (var i
= 0; i
< axObject
.childrenCount
; i
++) {
39 var axChild
= axObject
.childAtIndex(i
);
40 if (axChild
.isFocusable
)
41 axFocusableList
.push(axChild
);
42 appendFocusableDescendants(axChild
, axFocusableList
);
46 var container
= document
.getElementById("myContainer");
48 var axContainer
= accessibilityController
.focusedElement
;
50 var canvas
= document
.getElementById("myCanvas");
52 var axCanvas
= accessibilityController
.focusedElement
;
54 var axLayoutObjects
= [];
55 var axNodeObjects
= [];
57 appendFocusableDescendants(axContainer
, axLayoutObjects
);
58 appendFocusableDescendants(axCanvas
, axNodeObjects
);
60 shouldBe("axLayoutObjects.length", "axNodeObjects.length");
62 for (var i
= 0; i
< axLayoutObjects
.length
; i
++) {
63 var axLayoutObject
= axLayoutObjects
[i
];
64 var axNodeObject
= axNodeObjects
[i
];
65 shouldBe("i == " + i
+ "; axLayoutObject.role == axNodeObject.role", "true");