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
|
<html>
<head>
<title>ARIA menu events testing</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 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
const kViaDisplayStyle = 0;
const kViaVisibilityStyle = 1;
function focusMenu(aMenuBarID, aMenuID, aActiveMenuBarID) {
this.eventSeq = [];
if (aActiveMenuBarID) {
this.eventSeq.push(new invokerChecker(EVENT_MENU_END,
getNode(aActiveMenuBarID)));
}
this.eventSeq.push(new invokerChecker(EVENT_MENU_START, getNode(aMenuBarID)));
this.eventSeq.push(new invokerChecker(EVENT_FOCUS, getNode(aMenuID)));
this.invoke = function focusMenu_invoke() {
getNode(aMenuID).focus();
};
this.getID = function focusMenu_getID() {
return "focus menu '" + aMenuID + "'";
};
}
function showMenu(aMenuID, aParentMenuID, aHow) {
this.menuNode = getNode(aMenuID);
// Because of aria-owns processing we may have menupopup start fired before
// related show event.
this.eventSeq = [
new invokerChecker(EVENT_SHOW, this.menuNode),
new invokerChecker(EVENT_REORDER, getNode(aParentMenuID)),
new invokerChecker(EVENT_MENUPOPUP_START, this.menuNode),
];
this.invoke = function showMenu_invoke() {
if (aHow == kViaDisplayStyle)
this.menuNode.style.display = "block";
else
this.menuNode.style.visibility = "visible";
};
this.getID = function showMenu_getID() {
return "Show ARIA menu '" + aMenuID + "' by " +
(aHow == kViaDisplayStyle ? "display" : "visibility") +
" style tricks";
};
}
function closeMenu(aMenuID, aParentMenuID, aHow) {
this.menuNode = getNode(aMenuID);
this.menu = null;
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getMenu, this),
new invokerChecker(EVENT_MENUPOPUP_END, getMenu, this),
new invokerChecker(EVENT_REORDER, getNode(aParentMenuID)),
];
this.invoke = function closeMenu_invoke() {
// Store menu accessible reference while menu is still open.
this.menu = getAccessible(this.menuNode);
// Hide menu.
if (aHow == kViaDisplayStyle)
this.menuNode.style.display = "none";
else
this.menuNode.style.visibility = "hidden";
};
this.getID = function closeMenu_getID() {
return "Close ARIA menu " + aMenuID + " by " +
(aHow == kViaDisplayStyle ? "display" : "visibility") +
" style tricks";
};
function getMenu(aThisObj) {
return aThisObj.menu;
}
}
function focusInsideMenu(aMenuID, aMenuBarID) {
this.eventSeq = [
new invokerChecker(EVENT_FOCUS, getNode(aMenuID)),
];
this.unexpectedEventSeq = [
new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID)),
];
this.invoke = function focusInsideMenu_invoke() {
getNode(aMenuID).focus();
};
this.getID = function focusInsideMenu_getID() {
return "focus menu '" + aMenuID + "'";
};
}
function blurMenu(aMenuBarID) {
var eventSeq = [
new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID)),
new invokerChecker(EVENT_FOCUS, getNode("outsidemenu")),
];
this.__proto__ = new synthClick("outsidemenu", eventSeq);
this.getID = function blurMenu_getID() {
return "blur menu";
};
}
// //////////////////////////////////////////////////////////////////////////
// Do tests
// gA11yEventDumpToConsole = true; // debuging
// enableLogging("tree,events,verbose");
var gQueue = null;
function doTests() {
gQueue = new eventQueue();
gQueue.push(new focusMenu("menubar2", "menu-help"));
gQueue.push(new focusMenu("menubar", "menu-file", "menubar2"));
gQueue.push(new showMenu("menupopup-file", "menu-file", kViaDisplayStyle));
gQueue.push(new closeMenu("menupopup-file", "menu-file", kViaDisplayStyle));
gQueue.push(new showMenu("menupopup-edit", "menu-edit", kViaVisibilityStyle));
gQueue.push(new closeMenu("menupopup-edit", "menu-edit", kViaVisibilityStyle));
gQueue.push(new focusInsideMenu("menu-edit", "menubar"));
gQueue.push(new blurMenu("menubar"));
gQueue.push(new focusMenu("menubar3", "mb3-mi-outside"));
gQueue.push(new showMenu("mb4-menu", document, kViaDisplayStyle));
gQueue.push(new focusMenu("menubar4", "mb4-item1"));
gQueue.push(new focusMenu("menubar5", "mb5-mi"));
gQueue.push(new synthFocus("mi6"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=606207"
title="Dojo dropdown buttons are broken">
Bug 606207
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=614829"
title="Menupopup end event isn't fired for ARIA menus">
Bug 614829
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=615189"
title="Clean up FireAccessibleFocusEvent">
Bug 615189
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958"
title="Rework accessible focus handling">
Bug 673958
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=933322"
title="menustart/end events are missing when aria-owns makes a menu hierarchy">
Bug 933322
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=934460"
title="menustart/end events may be missed when top level menuitem is focused">
Bug 934460
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=970005"
title="infinite long loop in a11y:FocusManager::ProcessFocusEvent">
Bug 970005
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="menubar" role="menubar">
<div id="menu-file" role="menuitem" tabindex="0">
File
<div id="menupopup-file" role="menu" style="display: none;">
<div id="menuitem-newtab" role="menuitem" tabindex="0">New Tab</div>
<div id="menuitem-newwindow" role="menuitem" tabindex="0">New Window</div>
</div>
</div>
<div id="menu-edit" role="menuitem" tabindex="0">
Edit
<div id="menupopup-edit" role="menu" style="visibility: hidden;">
<div id="menuitem-undo" role="menuitem" tabindex="0">Undo</div>
<div id="menuitem-redo" role="menuitem" tabindex="0">Redo</div>
</div>
</div>
</div>
<div id="menubar2" role="menubar">
<div id="menu-help" role="menuitem" tabindex="0">
Help
<div id="menupopup-help" role="menu" style="display: none;">
<div id="menuitem-about" role="menuitem" tabindex="0">About</div>
</div>
</div>
</div>
<div tabindex="0" id="outsidemenu">outsidemenu</div>
<!-- aria-owns relations -->
<div id="menubar3" role="menubar" aria-owns="mb3-mi-outside"></div>
<div id="mb3-mi-outside" role="menuitem" tabindex="0">Outside</div>
<div id="menubar4" role="menubar">
<div id="mb4_topitem" role="menuitem" aria-haspopup="true"
aria-owns="mb4-menu">Item</div>
</div>
<div id="mb4-menu" role="menu" style="display:none;">
<div role="menuitem" id="mb4-item1" tabindex="0">Item 1.1</div>
<div role="menuitem" tabindex="0">Item 1.2</div>
</div>
<!-- focus top-level menu item having haspopup -->
<div id="menubar5" role="menubar">
<div role="menuitem" aria-haspopup="true" id="mb5-mi" tabindex="0">
Item
<div role="menu" style="display:none;">
<div role="menuitem" tabindex="0">Item 1.1</div>
<div role="menuitem" tabindex="0">Item 1.2</div>
</div>
</div>
</div>
<!-- other aria-owns relations -->
<div id="mi6" tabindex="0" role="menuitem">aria-owned item</div>
<div aria-owns="mi6">Obla</div>
<div id="eventdump"></div>
</body>
</html>
|