4 <script src=
"../../resources/js-test.js"></script>
7 <a id=
"link1" href=
"#">Link
</a>
8 <button id=
"button1">Button
</button>
9 <input id=
"text1" type=
"text">
10 <input id=
"checkbox1" type=
"checkbox">
11 <input id=
"radio1" type=
"radio">
12 <input id=
"slider1" type=
"range">
13 <input id=
"submit1" type=
"submit">
14 <select id=
"combobox1"><option>1<option>2</select>
15 <select id=
"listbox1" multiple
><option>1<option>2</select>
16 <textarea id=
"textarea1"></textarea>
17 <div id=
"focusable1" tabindex=
"0">Focusable
</div>
20 <canvas id=
"myCanvas" width=
"300" height=
"300">
21 <a id=
"link2" href=
"#">Link
</a>
22 <button id=
"button2">Button
</button>
23 <input id=
"text2" type=
"text">
24 <input id=
"checkbox2" type=
"checkbox">
25 <input id=
"radio2" type=
"radio">
26 <input id=
"slider2" type=
"range">
27 <input id=
"submit2" type=
"submit">
28 <select id=
"combobox2"><option>1<option>2</select>
29 <select id=
"listbox2" multiple
><option>1<option>2</select>
30 <textarea id=
"textarea2"></textarea>
31 <div id=
"focusable2" tabindex=
"0">Focusable
</div>
34 <canvas hidden
id=
"hiddenCanvas" width=
"300" height=
"300">
35 <a id=
"linkInHiddenCanvas" href=
"#">Link
</a>
38 <div id=
"console"></div>
40 description("This test makes sure that focusable elements in canvas fallback content are focusable.");
42 if (window
.testRunner
)
43 window
.testRunner
.dumpAsText();
46 function checkFocusable(id
) {
47 debug(id
+ " should be focusable.");
48 element
= document
.getElementById(id
);
50 shouldBe("document.activeElement == element", "true");
54 checkFocusable("link1");
55 checkFocusable("button1");
56 checkFocusable("text1");
57 checkFocusable("checkbox1");
58 checkFocusable("radio1");
59 checkFocusable("slider1");
60 checkFocusable("submit1");
61 checkFocusable("combobox1");
62 checkFocusable("listbox1");
63 checkFocusable("textarea1");
64 checkFocusable("focusable1");
66 checkFocusable("link2");
67 checkFocusable("button2");
68 checkFocusable("text2");
69 checkFocusable("checkbox2");
70 checkFocusable("radio2");
71 checkFocusable("slider2");
72 checkFocusable("submit2");
73 checkFocusable("combobox2");
74 checkFocusable("listbox2");
75 checkFocusable("textarea2");
76 checkFocusable("focusable2");
78 var previousFocusedElement
;
79 function checkNotFocusable(id
) {
80 debug(id
+ " should not be focusable.");
81 previousFocusedElement
= document
.activeElement
;
82 element
= document
.getElementById(id
);
84 shouldBe("document.activeElement == previousFocusedElement", "true");
88 checkNotFocusable("linkInHiddenCanvas");