-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
404 lines (385 loc) · 12.4 KB
/
index.html
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Anatomy of an Accessible Navigation Menu</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/white.css">
<!-- Theme used for syntax highlighted code -->
<link rel="stylesheet" href="plugin/highlight/vs.css">
<style type="text/css">
.reveal section {
text-align: left;
}
nav.menu-style{
color: #000;
}
nav.menu-style a{
color: #000;
padding: 0.25em;
text-decoration: none !important;
}
nav.menu-style ul{
list-style-type: none;
display: grid;
grid-template-columns: repeat(4, 1fr);
margin-left: 0;
}
nav.menu-style li{
}
nav.menu-style a:hover,
nav.menu-style a:focus {
color: #0d5f9d;
background-color: #fff;
text-decoration: underline !important;
}
nav.menu-style a:focus {
outline: solid 2px #0d5f9d;
outline-offset: 2px;
}
nav.menu-style a:active {
color: #072446;
background-color: #F3CD1D;
text-decoration: underline;
}
nav.menu-style [aria-current=page] {
background-color: #F3CD1D;
color: #072446;
border-bottom: .25em solid #072446;
}
</style>
</head>
<body>
<h1 style="display: none;">Anatomy of an Accessible Navigation Menu</h1>
<div class="reveal">
<div class="slides">
<section>
<h2>Anatomy of an Accessible Navigation Menu</h2>
<p>- Steve Jones</p>
<img style="margin-bottom:0px;" data-src="https://equalizedigital.com/wp-content/uploads/2022/11/Equalize-Digital-color-logo.svg" width="400" alt="Equalize Digital">
<p style="margin-top:0px;"><small><a href="https://equalizedigital.com">EqualizeDigital.com</a> | <a href="https://twitter.com/EqualizeDigital">@EqualizeDigital</a></small></p>
</section>
<section>
<h2>Why is an Accessible Navigation Important?</h2>
<ul>
<li>Inclusive User Experience</li>
<li>Legal and Policy Requirements</li>
<li>Ethical Responsibility</li>
<li>It defines the structure of a website</li>
<li>It avoids abandonment</li>
</ul>
</section>
<section>
<h2 class="r-fit-text">If it's not accessible <br />it's broken!</h2>
</section>
<section>
<h2>Menu Structure</h2>
<h3>Semantic Markup</h3>
<p>Using HTML elements for their given meaning, not just for their appearance.</p>
<h3>Adaptive</h3>
<p>Viewport, magnification, assistive technology</p>
<aside class="notes">
<h3>Semantic markup</h3>
<p>Semantic markup is a way of writing and structuring your HTML (Hypertext Markup Language) so that it reinforces the semantics, or meaning, of the content rather than its appearance.</p>
<p>Semantically coded menus adapt to small screens, magnification, and assistive techonology.</p>
</aside>
</section>
<section>
<h3>HTML Unordered</h3>
<p>When menu items are not in specific order.</p>
<pre>
<code data-trim>
<ul>
<li><a href="…">Home</a></li>
<li><a href="…">About</a></li>
<li><a href="…">Shop</a></li>
<li><a href="…">Contact</a></li>
…
</ul>
</code>
</pre>
</section>
<section>
<h3>HTML Ordered</h3>
<p>When menu items are in sequence.</p>
<pre>
<code data-trim>
<ol>
<li><a href="…">Download the Accessibility Checker plugin</a></li>
<li><a href="…">Upload the plugin to your website</a></li>
<li><a href="…">Activate the plugin</a></li>
<li><a href="…">Scan a post</a></li>
<li><a href="…">Fix accessibility issues</a></li>
…
</ol>
</code>
</pre>
</section>
<section>
<h3>Identify Menu</h3>
<p>Use HTML5 nav element</p>
<pre>
<code data-trim data-trim>
<nav>
<ul>
…
</ul>
</nav>
</code>
</pre>
</section>
<section>
<h3>Label Menu</h3>
<ul>
<li>Option 1: aria-label attribute</li>
<li>Option 2: aria-labelledby attribute</li>
</ul>
<pre>
<code data-trim data-trim data-line-numbers="1-4|6-10">
<!-- Option 1: aria-label -->
<nav aria-label="Main">
…
</nav>
<!-- Option 2: aria-labelledby -->
<nav aria-labelledby="mainmenulabel">
<h2 id="mainmenulabel">Main Menu</h2>
…
</nav>
</code>
</pre>
</section>
<section>
<h3>Indicate Current Menu Item</h3>
<p>Use aria-current attribute</p>
<pre>
<code data-trim data-trim data-line-numbers>
<li>
<a href="..." aria-current="page">
Contact Us
</a>
</li>
</code>
</pre>
</section>
<section>
<h3>Rendered Example</h3>
<nav aria-label="Main">
<ul>
<li><a href="#" aria-current="page">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Shop</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</section>
<section>
<h2>Menu Styling</h2>
<ul>
<li>Displayed in convential a location, such as the page header or left sidebar.</li>
<li>Easily identifed as a menu through propery markup and styles</li>
<li>Menu adapts to varying text and viewport sizes</li>
<li>Avoid line breaks, uppercase text, and hyphens</li>
<li>Adequate white space</li>
<li>Generous sizes for clickable areas</li>
</ul>
</section>
<section>
<h3>Hover and Focus States</h3>
<p>Changing hovered and focus states give uses visual guideance when navigating the menu.</p>
<pre>
<code data-trim data-trim>
nav a:hover,
nav a:focus {
color: #0d5f9d; /* blue */
background-color: #fff; /* white */
text-decoration: underline;
}
nav a:focus {
outline: solid 2px #0d5f9d; /* blue */
outline-offset: 2px;
}
</code>
</pre>
</section>
<section>
<h3>Active State</h3>
<p>Changing activated state helps users identify which menu item they've clicked.</p>
<pre>
<code data-trim data-trim>
nav a:active {
color: #072446; /* dark blue */
background-color: #F3CD1D; /* yellow */
text-decoration: underline;
}
</code>
</pre>
</section>
<section>
<h3>Current state</h3>
<p>Visually indicating the active menu item helps users identify the current page.</p>
<pre>
<code data-trim data-trim>
nav [aria-current=page] {
background-color: #F3CD1D; /* yellow */
color: #072446; /* dark blue */
border-bottom: .25em solid #072446; /* dark blue */
}
</code>
</pre>
</section>
<section>
<h3>Rendered Example</h3>
<nav class="menu-style" aria-label="Main">
<ul>
<li><a href="#" aria-current="page">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Shop</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</section>
<section>
<h2>Fly-out Menus</h2>
<ul>
<li>Defines websites hierarchy</li>
<li>Reduces multiple page loads</li>
<li>It's helpful to repeat submenus on the parent page</li>
</ul>
</section>
<section>
<h3>Fly-out Menu HTML Markup</h3>
<p>Fly-out menus are a nested list within the parent list item</p>
<pre>
<code data-trim data-line-numbers="5-11">
<nav aria-label="Main">
<ul>
<li><a href="…">Home</a></li>
<li><a href="…">About</a></li>
<li>
<a href="…">Shop</a>
<ul>
<li><a href="…">Cart</a></li>
<li><a href="…">My Account</a></li>
</ul>
</li>
<li><a href="…">Contact</a></li>
</ul>
</nav>
</code>
</pre>
</section>
<section>
<h3>Fly-out Functionality: Mouse Users</h3>
<ul>
<li>When parent menu item is hovered show submenu</li>
<li>Additional javascript can be used to add a close delay for imprecise mouse movement</li>
</ul>
<pre>
<code data-trim>
nav > ul li ul {
display: none;
}
nav > ul li:hover ul {
display: block;
}
</code>
</pre>
</section>
<section>
<h3>Fly-out Functionality: Keyboard Users</h3>
<ul>
<li>Button toggle with aria-haspopup equal to menu</li>
<li>Button toggle with aria-expanded</li>
<li>Hidden screen reader text labeled with the parent menu name and 'submenu' appended</li>
</ul>
<pre>
<code data-trim data-line-numbers="4-6|5-5">
...
<li>
<a href="…">Shop</a>
<button aria-expanded="false" aria-haspopup="true">
<span class="screen-readers">Shop: submenu</span>
</button>
<ul>
<li><a href="…">Cart</a></li>
<li><a href="…">My Account</a></li>
</ul>
</li>
...
</code>
</pre>
</section>
<section>
<h3>Fly-out Functionality: javascript</h3>
<ul>
<li>Keyboard users can navigate through parent menu items without having to navigate through all submenu items</li>
<li>On submenu button click or keypress, toggle submenu visibility and toggle the aria-expanded attribute</li>
<li>When on submenu pressing the escape key closes submenu and set the aria-expanded attribute to false and returns focus back to the submenu button</li>
<li>Only allow one submenu open at a time</li>
</ul>
</section>
<section>
<section>
<h2>Mobile Menu</h2>
<ul>
<li>Use a button to toggle menu visibility</li>
<li>Use aria-expanded attribute on menu toggle button</li>
<li>Set aria-controls to the menus id attribute</li>
</ul>
<pre>
<code data-trim data-line-numbers="1-2">
<button aria-expanded="false" aria-controls="site-header-menu">Menus</button>
<nav id="site-header-menu" aria-label="Main">
<ul>
<li><a href="…">Home</a></li>
<li><a href="…">About</a></li>
<li><a href="…">Shop</a></li>
<li><a href="…">Contact</a></li>
</ul>
</nav>
</code>
</pre>
</section>
</section>
<section>
<h3 class="r-fit-text">Live Example</h3>
</section>
<section>
<h3 class="r-fit-text">Code Example</h3>
<a class="r-fit-text" href="https://gist.github.com/SteveJonesDev/ce8bf0219e4ebe5582454022e429ef07" aria-label="Accessible Navigation Menu Gist">bit.ly/a11ynav</a>
</section>
<section>
<h2 style="margin-bottom: 0px;">Steve Jones</h2>
<p style="margin-top: 0px;"><small>Owner & CTO</small> <br />
<a href="https://twitter.com/stevejonesdev" aria-label="Steve Jones Twitter Profile">@stevejonesdev</a></p>
<p>Meetup:
<a href="https://equalizedigital.com/events" aria-label="WordPress Accessibility Meetup">Equalizedigital.com/events</a></p>
<p>Facebook Group:
<a href="https://www.facebook.com/groups/wordpress.accessibility" aria-label="WordPress Accessibility Facebook Group">facebook.com/groups/wordpress.accessibility</a></p>
<p>Podcast:
<a href="https://accessibilitycraft.com" aria-label="WordPress Accessibility Facebook Group">AccessibilityCraft.com</a></p>
<img style="margin-bottom:0px;" data-src="https://equalizedigital.com/wp-content/uploads/2022/11/Equalize-Digital-color-logo.svg" width="400" alt="Equalize Digital">
<p style="margin-top:0px;"><small><a href="https://equalizedigital.com">EqualizeDigital.com</a> | <a href="https://twitter.com/EqualizeDigital">@EqualizeDigital</a></small></p>
<aside class="notes">
</aside>
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
</body>
</html>