1<!DOCTYPE HTML>
2<html>
3<body>
4<script src="../js/resources/js-test-pre.js"></script>
5
6<div>
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="submit1" type="submit">
13 <select id="combobox1"><option>1<option>2</select>
14 <select id="listbox1" multiple><option>1<option>2</select>
15 <div id="focusable1" tabindex="0">Focusable</div>
16</div>
17
18<canvas id="myCanvas" width="300" height="300">
19 <a id="link2" href="#">Link</a>
20 <button id="button2">Button</button>
21 <input id="text2" type="text">
22 <input id="checkbox2" type="checkbox">
23 <input id="radio2" type="radio">
24 <input id="submit2" type="submit">
25 <select id="combobox2"><option>1<option>2</select>
26 <select id="listbox2" multiple><option>1<option>2</select>
27 <div id="focusable2" tabindex="0">Focusable</div>
28</canvas>
29
30<canvas hidden id="hiddenCanvas" width="300" height="300">
31 <a id="linkInHiddenCanvas" href="#">Link</a>
32</canvas>
33
34<div id="console"></div>
35<script>
36description("This test makes sure that focusable elements in canvas fallback content are focusable.");
37
38if (window.layoutTestController)
39 window.layoutTestController.dumpAsText();
40
41var element;
42function checkFocusable(id) {
43 debug(id + " should be focusable.");
44 element = document.getElementById(id);
45 element.focus();
46 shouldBe("document.activeElement == element", "true");
47 debug("");
48}
49
50checkFocusable("link1");
51checkFocusable("button1");
52checkFocusable("text1");
53checkFocusable("checkbox1");
54checkFocusable("radio1");
55checkFocusable("submit1");
56checkFocusable("combobox1");
57checkFocusable("listbox1");
58checkFocusable("focusable1");
59
60checkFocusable("link2");
61checkFocusable("button2");
62checkFocusable("text2");
63checkFocusable("checkbox2");
64checkFocusable("radio2");
65checkFocusable("submit2");
66checkFocusable("combobox2");
67checkFocusable("listbox2");
68checkFocusable("focusable2");
69
70var previousFocusedElement;
71function checkNotFocusable(id) {
72 debug(id + " should not be focusable.");
73 previousFocusedElement = document.activeElement;
74 element = document.getElementById(id);
75 element.focus();
76 shouldBe("document.activeElement == previousFocusedElement", "true");
77 debug("");
78}
79
80checkNotFocusable("linkInHiddenCanvas");
81
82</script>
83
84<script src="../js/resources/js-test-post.js"></script>
85</body>
86</html>