-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex2.html
More file actions
370 lines (339 loc) · 12.9 KB
/
Copy pathex2.html
File metadata and controls
370 lines (339 loc) · 12.9 KB
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!doctype html>
<html lang="en">
</html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Menu Elements Test Page</title>
<style>
menuitem {
justify-content: space-between;
padding: 6px 10px;
cursor: default;
user-select: none;
border-radius: 4px;
white-space: nowrap;
}
</style>
</head>
<h1>Menu Elements Test Page</h1>
<section aria-labelledby="valid-structures-heading">
<h2 id="valid-structures-heading">Valid structures</h2>
<p>In these first two examples, the content model is not violated.</p>
<section aria-labelledby="menubar-submenus-heading">
<h3 id="menubar-submenus-heading">Example 1. Menubar with Submenus</h3>
<p>
This is a horizontal menubar containing several top-level submenus (File, Edit, View, Help).
Clicking these opens a dropdown list of menu items.
</p>
<ul>
<li>
<strong>Nested Submenus:</strong> The "File" menu contains an "Open Recent" submenu, and
the "View" menu contains a "Zoom" submenu. These should open secondary dropdown lists when
activated.
</li>
<li>
<strong>Disabled Menu Items:</strong> The "File" menu contains a disabled "Print" item,
and the "View" menu contains a disabled but checked "Show Comments" item.
</li>
<li>
<strong>Single Checkable Items (Radio behavior):</strong> The "Zoom" submenu under "View"
has mutually exclusive options. Like radio buttons, checking one should deselect all
others. '100%' is initially checked.
</li>
<li>
<strong>Multiple Checkable Items (Checkbox behavior):</strong> The last three items in the
"View" menu are checkable. They should behave like checkboxes where multiple items can be
toggled on or off independently, except for the aforementioned "Show Comments", which is
checked by default and not modifiable by the user.
</li>
<li>
<strong>Separators:</strong> Some menus use horizontal lines (<code><hr></code>
elements) to visually group related items. There are 2 separators in the "File" menu, 1 in
the "Open Recent" submenu, 1 in the "Edit" menu, and 1 in the "View" menu.
</li>
</ul>
<p>Without further ado:</p>
<menubar>
<!-- File Menu -->
<submenu>
<menuitem>File</menuitem>
<menulist>
<menuitem>New</menuitem>
<!-- This item triggers a nested submenu (Level 2) -->
<submenu>
<menuitem>Open Recent</menuitem>
<menulist>
<menuitem>Document1.txt</menuitem>
<menuitem>Report.docx</menuitem>
<menuitem>Spreadsheet.xlsx</menuitem>
<hr />
<menuitem>Clear List</menuitem>
</menulist>
</submenu>
<hr />
<menuitem>Save</menuitem>
<menuitem>Save As...</menuitem>
<menuitem disabled>Print</menuitem>
<hr />
<menuitem>Exit</menuitem>
</menulist>
</submenu>
<!-- Edit Menu -->
<submenu>
<menuitem>Edit</menuitem>
<menulist>
<menuitem>Undo</menuitem>
<menuitem>Redo</menuitem>
<hr />
<menuitem>Cut</menuitem>
<menuitem>Copy</menuitem>
<menuitem>Paste</menuitem>
</menulist>
</submenu>
<!-- View Menu -->
<submenu>
<menuitem>View</menuitem>
<menulist>
<!-- This item triggers a nested submenu (Level 2) -->
<submenu>
<menuitem>Zoom</menuitem>
<menulist>
<fieldset checkable="single">
<menuitem>50%</menuitem>
<menuitem>75%</menuitem>
<menuitem defaultchecked>100%</menuitem>
<menuitem>150%</menuitem>
<menuitem>200%</menuitem>
</fieldset>
</menulist>
</submenu>
<menuitem>Full Screen</menuitem>
<hr />
<fieldset checkable="multiple">
<menuitem defaultchecked>Show Ruler</menuitem>
<menuitem>Show Outline</menuitem>
<menuitem defaultchecked disabled>Show Comments</menuitem>
</fieldset>
</menulist>
</submenu>
<!-- Help Menu -->
<submenu>
<menuitem>Help</menuitem>
<menulist>
<menuitem>About</menuitem>
<menuitem>Check for Updates...</menuitem>
</menulist>
</submenu>
</menubar>
</section>
<section aria-labelledby="menu-button-heading">
<h3 id="menu-button-heading">Example 2: Menu Button</h3>
<p>
This is a standalone button that triggers a menulist popover. It does not use a <code><menubar></code>.
</p>
<ul>
<li>
<strong>Trigger Button:</strong> A button labeled "Actions". Activating it opens a list of menu items.
</li>
<li>
<strong>Menu Items:</strong> The menu contains three items:
"Reply", "Forward", and "Delete". Clicking them does nothing.
</li>
</ul>
<button command="toggle-popover" commandfor="actions-menu">Actions</button>
<menulist id="actions-menu">
<menuitem>Reply</menuitem>
<menuitem>Forward</menuitem>
<menuitem>Delete</menuitem>
</menulist>
</section>
</section>
<hr>
<section aria-labelledby="broken-content-models-heading">
<h2 id="broken-content-models-heading">Violated Content Models</h2>
<p>
When the author breaks the content model, Blink switches the menulist or
menubar element, whichever contains the violation, to a dialog role. We
also switch keyboard navigation from arrow keys back to the Tab key. But,
does this actually work?? Can screenreader users access all the content in
"dialog mode"? How is keyboard navigation?
</p>
<section aria-labelledby="basic-broken">
<h3 id="basic-broken">Example 3: Bookmarks menubar</h3>
<p>
This is a menubar with a single menuitem, Bookmarks. Activating Bookmarks
shows four items, with a hr separator between the last two. The presence
of a button puts us in dialog mode, which in this case means the menulist
has a role of dialog instead of a role of menu. The items:
<ol>
<li>Add Bookmark -- this menuitem has a click handler that shows an alert</li>
<li>A button(!) -- both the button and the button menuitem have click handlers that show alerts</li>
<li>Delete Bookmark</li>
<li>Open Bookmark Manager</li>
</ol>
</p>
<menubar>
<submenu>
<menuitem>Bookmarks</menuitem>
<menulist>
<menuitem id="add-bookmark-item">Add Bookmark</menuitem>
<menuitem id="button-menuitem"><button id="inner-button">Some button</button></menuitem>
<menuitem>Delete Bookmark</menuitem>
<hr />
<menuitem>Open Bookmark Manager</menuitem>
</menulist>
</submenu>
</menubar>
</section>
<script>
document.addEventListener("DOMContentLoaded", () => {
const addBookmarkItem = document.getElementById("add-bookmark-item");
if (!addBookmarkItem) {
throw new Error("Critical Test Failure: The 'add-bookmark-item' element is missing from the DOM.");
}
addBookmarkItem.addEventListener("click", () => {
alert("Bookmark added!");
});
const buttonMenuitem = document.getElementById("button-menuitem");
if (!buttonMenuitem) {
throw new Error("Critical Test Failure: The 'button-menuitem' element is missing from the DOM.");
}
buttonMenuitem.addEventListener("click", () => {
alert("Button menuitem clicked!");
});
const innerButton = document.getElementById("inner-button");
if (!innerButton) {
throw new Error("Critical Test Failure: The 'inner-button' element is missing from the DOM.");
}
innerButton.addEventListener("click", (e) => {
alert("Inner button clicked!");
});
});
</script>
<section aria-labelledby="complex-broken">
<h3 id="complex-broken">Example 4: Broken File menu</h3>
<p>
This is the original File, Edit.. etc menu. Except this time there's a
link at File > New. Selecting File > Open Recent's submenu seems
difficult with our current implementation. You have to Tab from new to
Open Recent, then activate with enter or space, then resume arrow key
navigation. Left arrow from Open Recent's submenu moves focus back onto
Open Recent, but you can't use right arrow to go back into the submenu.
Yeah, seems not great.
</p>
<menubar>
<!-- File Menu -->
<submenu>
<menuitem>File</menuitem>
<menulist>
<menuitem><a href="#" style="display: initial !important">New</a></menuitem>
<!-- This item triggers a nested submenu (Level 2) -->
<submenu>
<menuitem>Open Recent</menuitem>
<menulist>
<menuitem>Document1.txt</menuitem>
<menuitem>Report.docx</menuitem>
<menuitem>Spreadsheet.xlsx</menuitem>
<hr />
<menuitem>Clear List</menuitem>
</menulist>
</submenu>
<hr />
<menuitem>Save</menuitem>
<menuitem>Save As...</menuitem>
<menuitem disabled>Print</menuitem>
<hr />
<menuitem>Exit</menuitem>
</menulist>
</submenu>
<!-- Edit Menu -->
<submenu>
<menuitem>Edit</menuitem>
<menulist>
<menuitem>Undo</menuitem>
<menuitem>Redo</menuitem>
<hr />
<menuitem>Cut</menuitem>
<menuitem>Copy</menuitem>
<menuitem>Paste</menuitem>
</menulist>
</submenu>
<!-- View Menu -->
<submenu>
<menuitem>View</menuitem>
<menulist>
<!-- This item triggers a nested submenu (Level 2) -->
<submenu>
<menuitem>Zoom</menuitem>
<menulist>
<fieldset checkable="single">
<menuitem>50%</menuitem>
<menuitem>75%</menuitem>
<menuitem defaultchecked>100%</menuitem>
<menuitem>150%</menuitem>
<menuitem>200%</menuitem>
</fieldset>
</menulist>
</submenu>
<menuitem>Full Screen</menuitem>
<hr />
<fieldset checkable="multiple">
<menuitem defaultchecked>Show Ruler</menuitem>
<menuitem>Show Outline</menuitem>
<menuitem defaultchecked disabled>Show Comments</menuitem>
</fieldset>
</menulist>
</submenu>
<!-- Help Menu -->
<submenu>
<menuitem>Help</menuitem>
<menulist>
<menuitem>About</menuitem>
<menuitem>Check for Updates...</menuitem>
</menulist>
</submenu>
</menubar>
</section>
<section aria-labelledby="forced-nav-heading">
<h3 id="forced-nav-heading">Example 5: Forced Navigation Menu</h3>
<p>
This example demonstrates an author explicitly disregarding the spec and using the menu elements for site navigation. By placing <code><a></code> tags inside the menu items and forcing <code>display: initial !important;</code>, they have overridden the UA's default accessibility safeguard (<code>display: none</code>).
</p>
<menubar>
<menuitem><a href="home.html" style="display: initial !important;">Home</a></menuitem>
<submenu>
<menuitem>Services</menuitem>
<menulist>
<menuitem><a href="services/web-dev.html" style="display: initial !important;">Web Development</a></menuitem>
<menuitem><a href="services/seo.html" style="display: initial !important;">SEO</a></menuitem>
<submenu>
<menuitem>Marketing</menuitem>
<menulist>
<menuitem><a href="marketing/social.html" style="display: initial !important;">Social Media</a></menuitem>
<menuitem><a href="marketing/email.html" style="display: initial !important;">Email Campaigns</a></menuitem>
</menulist>
</submenu>
</menulist>
</submenu>
<submenu>
<menuitem>About Us</menuitem>
<menulist>
<menuitem><a href="about/team.html" style="display: initial !important;">Our Team</a></menuitem>
<menuitem><a href="about/careers.html" style="display: initial !important;">Careers</a></menuitem>
</menulist>
</submenu>
<menuitem><a href="contact.html" style="display: initial !important;">Contact Us</a></menuitem>
</menubar>
</section>
</section>
<hr style="margin-bottom: 250px;">
<!-- Blank space because of https://crbug.com/546207253 -->
<script>
const supported = "HTMLMenuListElement" in window;
if (!supported) {
document.querySelector("h1").textContent =
"Menu elements are not supported by this browser!!";
}
</script>
</html>