|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=429547 |
|
5 --> |
|
6 <head> |
|
7 <title>aria-activedescendant focus tests</title> |
|
8 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
9 |
|
10 <script type="application/javascript" |
|
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
12 |
|
13 <script type="application/javascript" |
|
14 src="../common.js"></script> |
|
15 <script type="application/javascript" |
|
16 src="../role.js"></script> |
|
17 <script type="application/javascript" |
|
18 src="../states.js"></script> |
|
19 <script type="application/javascript" |
|
20 src="../events.js"></script> |
|
21 |
|
22 <script type="application/javascript"> |
|
23 //gA11yEventDumpToConsole = true; // debugging |
|
24 |
|
25 function changeARIAActiveDescendant(aID, aItemID) |
|
26 { |
|
27 this.eventSeq = [ |
|
28 new focusChecker(aItemID) |
|
29 ]; |
|
30 |
|
31 this.invoke = function changeARIAActiveDescendant_invoke() |
|
32 { |
|
33 getNode(aID).setAttribute("aria-activedescendant", aItemID); |
|
34 } |
|
35 |
|
36 this.getID = function changeARIAActiveDescendant_getID() |
|
37 { |
|
38 return "change aria-activedescendant on " + aItemID; |
|
39 } |
|
40 } |
|
41 |
|
42 function insertItemNFocus(aID, aNewItemID) |
|
43 { |
|
44 this.eventSeq = [ |
|
45 new invokerChecker(EVENT_SHOW, aNewItemID), |
|
46 new focusChecker(aNewItemID) |
|
47 ]; |
|
48 |
|
49 this.invoke = function insertItemNFocus_invoke() |
|
50 { |
|
51 var container = getNode(aID); |
|
52 var itemNode = document.createElement("div"); |
|
53 itemNode.setAttribute("id", aNewItemID); |
|
54 itemNode.textContent = "item3"; |
|
55 container.appendChild(itemNode); |
|
56 |
|
57 container.setAttribute("aria-activedescendant", aNewItemID); |
|
58 } |
|
59 |
|
60 this.getID = function insertItemNFocus_getID() |
|
61 { |
|
62 return "insert new node and focus it with ID: " + aNewItemID; |
|
63 } |
|
64 } |
|
65 |
|
66 var gQueue = null; |
|
67 function doTest() |
|
68 { |
|
69 gQueue = new eventQueue(); |
|
70 |
|
71 gQueue.push(new synthFocus("container", new focusChecker("item1"))); |
|
72 gQueue.push(new changeARIAActiveDescendant("container", "item2")); |
|
73 |
|
74 gQueue.push(new synthFocus("combobox_entry", new focusChecker("combobox_entry"))); |
|
75 gQueue.push(new changeARIAActiveDescendant("combobox", "combobox_option2")); |
|
76 |
|
77 todo(false, "No focus for inserted element, bug 687011"); |
|
78 //gQueue.push(new insertItemNFocus("container", "item3")); |
|
79 |
|
80 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
81 } |
|
82 |
|
83 SimpleTest.waitForExplicitFinish(); |
|
84 addA11yLoadEvent(doTest); |
|
85 </script> |
|
86 </head> |
|
87 <body> |
|
88 |
|
89 <a target="_blank" |
|
90 href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547" |
|
91 title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()"> |
|
92 Mozilla Bug 429547 |
|
93 </a> |
|
94 <a target="_blank" |
|
95 href="https://bugzilla.mozilla.org/show_bug.cgi?id=761102" |
|
96 title="Focus may be missed when ARIA active-descendant is changed on active composite widget"> |
|
97 Mozilla Bug 761102 |
|
98 </a> |
|
99 <p id="display"></p> |
|
100 <div id="content" style="display: none"></div> |
|
101 <pre id="test"> |
|
102 </pre> |
|
103 |
|
104 <div role="listbox" aria-activedescendant="item1" id="container" tabindex="1"> |
|
105 <div role="listitem" id="item1">item1</div> |
|
106 <div role="listitem" id="item2">item2</div> |
|
107 </div> |
|
108 |
|
109 <div role="combobox" id="combobox"> |
|
110 <input id="combobox_entry"> |
|
111 <ul> |
|
112 <li role="option" id="combobox_option1">option1</li> |
|
113 <li role="option" id="combobox_option2">option2</li> |
|
114 </ul> |
|
115 </div> |
|
116 </body> |
|
117 </html> |