blob: 784f28070fc559018dc95306892614240a0cfb92 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<article>
2<p>A menu button is a button that opens a menu. It is often styled as a typical push button with a
3downward pointing arrow or triangle to hint that activating the button will display a menu.
4The menu button has roles, attributes and behaviour as outlined in
5<a href="https://www.w3.org/TR/wai-aria-practices/#menubutton" target="_blank">WAI-ARIA Authoring Practices</a>.
6</p>
7</article>
8
9<link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
10
11<style>
12 .size-22 {
13 font-size: 22px;
14 width: 22px;
15 text-align: center;
16 vertical-align: middle;
17 }
18
19 .mdl-cell p {
20 margin-bottom: 0;
21 white-space: nowrap;
22 text-overflow: ellipsis;
23 overflow: hidden;
24 }
25
26
27 .mdl-textfield.mdlext-js-menu-button .mdl-textfield__input {
28 padding-right: 40px;
29 }
30
31 .mdl-textfield__icon {
32 width: 32px;
33 text-align: left;
34 position: absolute;
35 right: 0;
36 top: 50%;
37 transform: translateY(-50%);
38 }
39
40 .mdl-textfield.is-disabled .mdl-textfield__icon {
41 color: rgba(0, 0, 0, 0.26) !important;
42 }
43
44 .mdl-textfield.is-invalid .mdl-textfield__icon {
45 color: #de3226 !important;
46 }
47
48 #max-width-menu {
49 max-width: 400px;
50 }
51
52</style>
53
54<script>
55 function signedIn(sn) {
56 return 'Signed in with&nbsp;&nbsp;<i class="size-22 icon ion-social-' + sn + '"></i>&nbsp;';
57 }
58 function signedInIcon(sn) {
59 return '<i class="size-22 icon ion-social-' + sn + '"></i>';
60 }
61</script>
62
63<div class="mdl-grid mdl-grid--no-spacing">
64 <div class="mdl-cell mdl-cell--4-col">
65 <p><code>mdl-button</code></p>
66 <button id="btn-social-1" style="width:100%; max-width:300px; height:46px"
67 class="mdl-button mdl-button--colored mdl-button--raised mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button"
68 aria-controls="shared-social-menu" >
69 <i class="material-icons">person_outline</i>
70 <span class="mdlext-menu-button__caption">Sign in with ...</span>
71 <i class="material-icons mdlext-aria-expanded-more-less"></i>
72 </button>
73 <script>
74 document.querySelector('#btn-social-1').addEventListener('menuselect', function(event) {
75 this.querySelector('.mdlext-menu-button__caption').innerHTML = signedIn(event.detail.source.getAttribute('data-value'));
76 });
77 </script>
78 </div> <!--cell -->
79
80 <div class="mdl-cell mdl-cell--4-col">
81 <p><code>mdl-textfield</code></p>
82 <div id="btn-social-2"
83 class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label mdlext-js-menu-button"
84 aria-controls="shared-social-menu">
85 <input class="mdl-textfield__input" type="text" readonly>
86 <label class="mdl-textfield__label">Sign in with ...</label>
87 <i class="material-icons mdl-textfield__icon mdlext-aria-expanded-more-less"></i>
88 </div>
89 <script>
90 document.querySelector('#btn-social-2').addEventListener('menuselect', function(event) {
91 this.MaterialTextfield.change(event.detail.source.querySelector('span').innerHTML);
92 });
93 </script>
94 </div> <!--cell -->
95
96 <div class="mdl-cell mdl-cell--4-col mdlext-bordered-fields">
97 <p><code>mdlext-bordered-fields</code></p>
98 <div id="btn-social-3"
99 class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label mdlext-bordered-fields__icon-right mdlext-js-menu-button"
100 aria-controls="shared-social-menu">
101 <input class="mdl-textfield__input" type="text" readonly>
102 <label class="mdl-textfield__label">Sign in with ...</label>
103 <i class="material-icons mdlext-aria-expanded-more-less"></i>
104 </div>
105 <script>
106 document.querySelector('#btn-social-3').addEventListener('menuselect', function(event) {
107 this.MaterialTextfield.change(event.detail.source.querySelector('span').innerHTML);
108 });
109 </script>
110 </div> <!--cell -->
111
112 <div class="mdl-cell mdl-cell--4-col">
113 <p>custom styled <code>&lt;div&gt;</code></p>
114 <div id="btn-social-4"
115 class="mdlext-menu-button mdlext-js-menu-button" style="width:300px; height:46px; max-width:100%; border:1px solid green"
116 aria-controls="shared-social-menu">
117 <span class="mdlext-menu-button__caption">Sign in with ...</span>
118 <i class="material-icons mdlext-aria-expanded-more-less"></i>
119 </div>
120 <script>
121 document.querySelector('#btn-social-4').addEventListener('menuselect', function(event) {
122 this.querySelector('span').innerHTML = signedIn(event.detail.source.getAttribute('data-value')) + ', ' +
123 event.detail.source.querySelector('span').innerHTML;
124 });
125 </script>
126 </div> <!--cell -->
127
128
129 <div class="mdl-cell mdl-cell--4-col">
130 <p>mdl-button--icon</p>
131
132 <button id="btn-social-5" style="height:46px; width:46px;"
133 class="mdl-button mdl-js-button mdl-button--icon mdlext-js-menu-button"
134 aria-controls="shared-social-menu">
135 <i class="material-icons">more_vert</i>
136 </button>
137 <script>
138 document.querySelector('#btn-social-5').addEventListener('menuselect', function(event) {
139 this.innerHTML = signedInIcon(event.detail.source.getAttribute('data-value'));
140 });
141 </script>
142
143 </div> <!--cell -->
144
145</div> <!-- grid -->
146
147<ul id="shared-social-menu" class="mdlext-menu" hidden >
148 <li class="mdlext-menu__item" data-value="twitter">
149 <span class="mdlext-menu__item__caption">Twitter</span>
150 <i class="icon ion-social-twitter-outline size-22"></i>
151 </li>
152 <li class="mdlext-menu__item" data-value="github">
153 <span class="mdlext-menu__item__caption">GitHub</span>
154 <i class="ion-social-github-outline size-22"></i>
155 </li>
156 <li class="mdlext-menu__item" data-value="googleplus">
157 <span class="mdlext-menu__item__caption">G+</span>
158 <i class="ion-social-googleplus-outline size-22"></i>
159 </li>
160 <li class="mdlext-menu__item" data-value="linkedin">
161 <span class="mdlext-menu__item__caption">LinkedIn</span>
162 <i class="icon ion-social-linkedin-outline size-22"></i>
163 </li>
164 <li class="mdlext-menu__item" data-value="facebook">
165 <span class="mdlext-menu__item__caption">Facebook</span>
166 <i class="icon ion-social-facebook-outline size-22"></i>
167 </li>
168</ul>
169
170<p style="margin-top: 16px;">Menu buttons positioned left, middle and right, using <code>textalign</code>.</p>
171<div role="presentation">
172 <button class="mdl-button mdl-button--raised mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button">
173 <i class="material-icons">gesture</i>
174 <span class="mdlext-menu-button__caption">Select</span>
175 <i class="material-icons mdlext-aria-expanded-more-less"></i>
176 </button>
177 <ul id="max-width-menu" class="mdlext-menu" hidden >
178 <li class="mdlext-menu__item">
179 <i class="material-icons md-18">info</i>
180 <span class="mdlext-menu__item__caption">Menu item #1</span>
181 </li>
182 <li class="mdlext-menu__item">
183 <i class="material-icons md-18">help_outline</i>
184 <span class="mdlext-menu__item__caption">Menu item #2. A long text to check ellipsis overflow 0123456789</span>
185 <i class="material-icons md-18">radio</i>
186 </li>
187 <li class="mdlext-menu__item-separator"></li>
188 <li class="mdlext-menu__item" disabled>
189 <span class="mdlext-menu__item__caption">Menu item #3, disabled</span>
190 <i class="material-icons md-18">accessibility</i>
191 </li>
192 <li class="mdlext-menu__item-separator"></li>
193 <li class="mdlext-menu__item">
194 <span class="mdlext-menu__item__caption">Menu item #IV</span>
195 <i class="material-icons md-18">build</i>
196 </li>
197 <li class="mdlext-menu__item">
198 <span class="mdlext-menu__item__caption">Menu item #V</span>
199 <i class="material-icons md-18">build</i>
200 </li>
201 <li class="mdlext-menu__item-separator"></li>
202 <li class="mdlext-menu__item">
203 <span class="mdlext-menu__item__caption">Menu item #VI</span>
204 <i class="material-icons md-18">build</i>
205 </li>
206 <li class="mdlext-menu__item">
207 <span class="mdlext-menu__item__caption">Menu item #VII</span>
208 <i class="material-icons md-18">build</i>
209 </li>
210 <li class="mdlext-menu__item">
211 Menu item #n
212 </li>
213 </ul>
214</div>
215
216
217<div role="presentation" style="text-align: center">
218 <button class="mdl-button mdl-button--raised mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button">
219 <i class="material-icons">gesture</i>
220 <span class="mdlext-menu-button__caption">Select</span>
221 <i class="material-icons mdlext-aria-expanded-more-less"></i>
222 </button>
223 <ul class="mdlext-menu" hidden >
224 <li class="mdlext-menu__item">
225 <i class="material-icons md-18">info</i>
226 <span class="mdlext-menu__item__caption">Menu item #1</span>
227 </li>
228 <li class="mdlext-menu__item">
229 <i class="material-icons md-18">help_outline</i>
230 <span class="mdlext-menu__item__caption">Menu item #2</span>
231 <i class="material-icons md-18">radio</i>
232 </li>
233 <li class="mdlext-menu__item" disabled>
234 <span class="mdlext-menu__item__caption">Menu item #3, disabled</span>
235 <i class="material-icons md-18">accessibility</i>
236 </li>
237 <li class="mdlext-menu__item-separator"></li>
238 <li class="mdlext-menu__item">
239 <span class="mdlext-menu__item__caption">Menu item #IV</span>
240 <i class="material-icons md-18">build</i>
241 </li>
242 <li class="mdlext-menu__item">
243 <span class="mdlext-menu__item__caption">Menu item #V</span>
244 <i class="material-icons md-18">build</i>
245 </li>
246 <li class="mdlext-menu__item">
247 <span class="mdlext-menu__item__caption">Menu item #VI</span>
248 <i class="material-icons md-18">build</i>
249 </li>
250 <li class="mdlext-menu__item">
251 <span class="mdlext-menu__item__caption">Menu item #VII</span>
252 <i class="material-icons md-18">build</i>
253 </li>
254 <li class="mdlext-menu__item">
255 <span class="mdlext-menu__item__caption">Menu item #VIII</span>
256 <i class="material-icons md-18">build</i>
257 </li>
258 <li class="mdlext-menu__item">
259 <span class="mdlext-menu__item__caption">Menu item #IX</span>
260 <i class="material-icons md-18">build</i>
261 </li>
262 <li class="mdlext-menu__item">
263 <span class="mdlext-menu__item__caption">Menu item #X</span>
264 <i class="material-icons md-18">build</i>
265 </li>
266 <li class="mdlext-menu__item">
267 <span class="mdlext-menu__item__caption">Menu item #XI</span>
268 <i class="material-icons md-18">build</i>
269 </li>
270 <li class="mdlext-menu__item">
271 <span class="mdlext-menu__item__caption">Menu item #XII</span>
272 <i class="material-icons md-18">build</i>
273 </li>
274 <li class="mdlext-menu__item">
275 <span class="mdlext-menu__item__caption">Menu item #XIII</span>
276 <i class="material-icons md-18">build</i>
277 </li>
278 <li class="mdlext-menu__item">
279 <span class="mdlext-menu__item__caption">Menu item #XIV</span>
280 <i class="material-icons md-18">build</i>
281 </li>
282 <li class="mdlext-menu__item">
283 <span class="mdlext-menu__item__caption">Menu item #XV</span>
284 <i class="material-icons md-18">build</i>
285 </li>
286 <li class="mdlext-menu__item">
287 <span class="mdlext-menu__item__caption">Menu item #XVI</span>
288 <i class="material-icons md-18">build</i>
289 </li>
290 <li class="mdlext-menu__item">
291 <span class="mdlext-menu__item__caption">Menu item #XVII</span>
292 <i class="material-icons md-18">build</i>
293 </li>
294 <li class="mdlext-menu__item">
295 <span class="mdlext-menu__item__caption">Menu item #XVIII</span>
296 <i class="material-icons md-18">build</i>
297 </li>
298 <li class="mdlext-menu__item">
299 <span class="mdlext-menu__item__caption">Menu item #XIX</span>
300 <i class="material-icons md-18">build</i>
301 </li>
302 <li class="mdlext-menu__item">
303 <span class="mdlext-menu__item__caption">Menu item #XX</span>
304 <i class="material-icons md-18">build</i>
305 </li>
306 <li class="mdlext-menu__item">
307 Menu item #n
308 </li>
309 </ul>
310</div>
311
312
313<div role="presentation" style="text-align: right">
314 <button class="mdl-button mdl-button--raised mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button">
315 <i class="material-icons">gesture</i>
316 <span class="mdlext-menu-button__caption">Select</span>
317 <i class="material-icons mdlext-aria-expanded-more-less"></i>
318 </button>
319 <ul class="mdlext-menu" hidden >
320 <li class="mdlext-menu__item">
321 <i class="material-icons md-18">info</i>
322 <span class="mdlext-menu__item__caption">Menu item #1</span>
323 </li>
324 <li class="mdlext-menu__item">
325 <i class="material-icons md-18">help_outline</i>
326 <span class="mdlext-menu__item__caption">Menu item #2</span>
327 <i class="material-icons md-18">radio</i>
328 </li>
329 <li class="mdlext-menu__item" disabled>
330 <span class="mdlext-menu__item__caption">Menu item #3, disabled</span>
331 <i class="material-icons md-18">accessibility</i>
332 </li>
333 <li class="mdlext-menu__item">
334 <span class="mdlext-menu__item__caption">Menu item #IV</span>
335 <i class="material-icons md-18">build</i>
336 </li>
337 <li class="mdlext-menu__item-separator"></li>
338 <li class="mdlext-menu__item">
339 <span class="mdlext-menu__item__caption">Menu item #V</span>
340 <i class="material-icons md-18">build</i>
341 </li>
342 <li class="mdlext-menu__item">
343 <span class="mdlext-menu__item__caption">Menu item #VI</span>
344 <i class="material-icons md-18">build</i>
345 </li>
346 <li class="mdlext-menu__item">
347 <span class="mdlext-menu__item__caption">Menu item #VII</span>
348 <i class="material-icons md-18">build</i>
349 </li>
350 <li class="mdlext-menu__item">
351 Menu item #n
352 </li>
353 </ul>
354</div>
355
356
357<p style="margin-top: 16px">This menu button has WAIA roles and attributes coded in markup</p>
358<button id="aria-demo-button"
359 class="mdl-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button"
360 role="button"
361 aria-haspopup="true"
362 aria-controls="menu-example-dropdown"
363 aria-expanded="false"
364 tabindex="0">
365 <span class="mdlext-menu-button__caption">Select a size</span>
366 <i class="mdlext-aria-expanded-plus-minus"></i>
367</button>
368<script>
369 document.querySelector('#aria-demo-button').addEventListener('menuselect', function(event) {
370 this.querySelector('span').innerHTML = 'Size: ' + event.detail.source.innerHTML;
371 });
372</script>
373<ul id="menu-example-dropdown"
374 class="mdlext-menu"
375 role="menu"
376 hidden >
377 <li class="mdlext-menu__item" role="menuitem">X Small</li>
378 <li class="mdlext-menu__item-separator" role="separator"></li>
379 <li class="mdlext-menu__item" role="menuitem">Small</li>
380 <li class="mdlext-menu__item" role="menuitem">Medium</li>
381 <li class="mdlext-menu__item" role="menuitem">Large</li>
382 <li class="mdlext-menu__item-separator" role="separator"></li>
383 <li class="mdlext-menu__item" role="menuitem">X Large</li>
384 <li class="mdlext-menu__item" role="menuitem">XXX Large</li>
385</ul>
386
387<p style="margin-top: 16px">A disabled menu button should do nothing</p>
388<div role="presentation">
389 <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdlext-js-menu-button" disabled>
390 <span class="mdlext-menu-button__caption">Disabled</span>
391 <i class="material-icons mdlext-aria-expanded-more-less"></i>
392 </button>
393 <ul class="mdlext-menu" hidden>
394 <li class="mdlext-menu__item">Menu item #1</li>
395 </ul>
396</div>
397
398
399<p style="margin-top: 16px">Menu buttons inside a table. Menus placed inside and after the table element to verify
400 that positioning works as expected.</p>
401
402<div style="position:relative; border:2px solid green; overflow: hidden;">
403<p>The box with green borders has <code>overflow:hidden</code></p>
404<div>
405
406 <table id="a-table-with-menu-buttons"
407 class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp" style="width: 48%; float:left;">
408 <thead>
409 <tr>
410 <th class="mdl-data-table__cell--non-numeric">Material</th>
411 <th>Quantity</th>
412 <th>Unit price</th>
413 </tr>
414 </thead>
415 <tbody>
416 <tr>
417 <td class="mdl-data-table__cell--non-numeric">Acrylic (Transparent)</td>
418 <td>
419 <span style="width:40px; display: inline-block;"></span>
420 <button class="mdl-button mdl-js-button mdl-button--icon mdl-button--primary mdlext-js-menu-button"
421 aria-controls="table-menu-example">
422 <i class="mdlext-aria-expanded-more-less"></i>
423 </button>
424 </td>
425 <td>$2.90</td>
426 </tr>
427 <tr>
428 <td class="mdl-data-table__cell--non-numeric">Plywood (Birch)</td>
429 <td>
430 <span style="width:40px; display: inline-block;"></span>
431 <button class="mdl-button mdl-js-button mdl-button--icon mdl-button--primary mdlext-js-menu-button"
432 aria-controls="table-menu-example">
433 <i class="mdlext-aria-expanded-more-less"></i>
434 </button>
435 </td>
436 <td>$1.25</td>
437 </tr>
438 <tr>
439 <td class="mdl-data-table__cell--non-numeric">Laminate (Gold on Blue)</td>
440 <td>
441 <span style="width:40px; display: inline-block;"></span>
442 <button class="mdl-button mdl-button--icon mdl-button--primary mdl-js-button mdlext-js-menu-button"
443 aria-controls="table-menu-example">
444 <i class="mdlext-aria-expanded-more-less"></i>
445 </button>
446 </td>
447 <td>$2.35</td>
448 </tr>
449 </tbody>
450 </table>
451
452 <script>
453 document.querySelector('#a-table-with-menu-buttons').addEventListener('menuselect', function(event) {
454 var span = event.target.closest('td').querySelector('span');
455 span.innerHTML = event.detail.source.getAttribute('data-value');
456 });
457 </script>
458
459 <div role="presentation" style="width:48%; float:right;">
460 <p style="margin-top: 16px">This menu button has a menu with dark color theme, <code>mdlext-dark-color-theme</code> class</p>
461
462 <button class="mdl-button mdl-button--raised mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button">
463 <i class="material-icons">gesture</i>
464 <span class="mdlext-menu-button__caption">Select</span>
465 <i class="material-icons mdlext-aria-expanded-more-less"></i>
466 </button>
467 <ul class="mdlext-menu mdlext-dark-color-theme" hidden >
468 <li class="mdlext-menu__item">
469 <i class="material-icons md-18">info</i>
470 <span class="mdlext-menu__item__caption">Menu item #1</span>
471 </li>
472 <li class="mdlext-menu__item">
473 <i class="material-icons md-18">help_outline</i>
474 <span class="mdlext-menu__item__caption">Menu item #2. A long text to check ellipsis overflow 0123456789</span>
475 <i class="material-icons md-18">radio</i>
476 </li>
477 <li class="mdlext-menu__item-separator"></li>
478 <li class="mdlext-menu__item" disabled>
479 <span class="mdlext-menu__item__caption">Menu item #3, disabled</span>
480 <i class="material-icons md-18">accessibility</i>
481 </li>
482 <li class="mdlext-menu__item-separator"></li>
483 <li class="mdlext-menu__item">
484 <span class="mdlext-menu__item__caption">Menu item #IV</span>
485 <i class="material-icons md-18">build</i>
486 </li>
487 <li class="mdlext-menu__item">
488 <span class="mdlext-menu__item__caption">Menu item #V</span>
489 <i class="material-icons md-18">build</i>
490 </li>
491 <li class="mdlext-menu__item-separator"></li>
492 <li class="mdlext-menu__item">
493 <span class="mdlext-menu__item__caption">Menu item #VI</span>
494 <i class="material-icons md-18">build</i>
495 </li>
496 </ul>
497 </div>
498
499</div>
500</div>
501
502<ul id="table-menu-example" class="mdlext-menu" hidden >
503 <li class="mdlext-menu__item" data-value="10">Ten</li>
504 <li class="mdlext-menu__item" data-value="25">Twentyfive</li>
505 <li class="mdlext-menu__item" data-value="50">Fifty</li>
506</ul>
507
508
509<style>
510 .demo-grid {
511 margin-top: 32px;
512 }
513 .demo-grid .mdl-cell {
514 background: rgb(63,81,181);
515 text-align: center;
516 color: white;
517 padding: 16px 8px;
518 border: 1px solid #aaaaaa;
519 }
520 .demo-grid .mdl-cell:nth-child(odd) {
521 background: rgb(33,150,243);
522 }
523</style>
524
525
526<div id="a-grid-with-menu-buttons" class="demo-grid">
527 <p>Menu buttons inside <code>mdl-grid</code></p>
528
529 <div id="menu-button-grid" class="mdl-grid mdl-grid--no-spacing">
530 <div class="mdl-cell mdl-cell--4-col mdl-cell--4-col-tablet mdl-cell--2-col-phone">
531 <button class="mdl-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button">
532 <span class="mdlext-menu-button__caption">Select a size</span>
533 <i class="mdlext-aria-expanded-plus-minus"></i>
534 </button>
535 <ul class="mdlext-menu"
536 role="menu"
537 hidden >
538 <li class="mdlext-menu__item" role="menuitem">Small</li>
539 <li class="mdlext-menu__item" role="menuitem">Medium</li>
540 <li class="mdlext-menu__item" role="menuitem">Large</li>
541 </ul>
542 </div>
543 <div class="mdl-cell mdl-cell--5-col mdl-cell--4-col-tablet mdl-cell--2-col-phone">
544 <button class="mdl-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button">
545 <span class="mdlext-menu-button__caption">Select a size</span>
546 <i class="mdlext-aria-expanded-plus-minus"></i>
547 </button>
548 <ul class="mdlext-menu"
549 role="menu"
550 hidden >
551 <li class="mdlext-menu__item" role="menuitem">Small</li>
552 <li class="mdlext-menu__item" role="menuitem">Medium</li>
553 <li class="mdlext-menu__item" role="menuitem">Large</li>
554 </ul>
555 </div>
556 <div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-tablet mdl-cell--hide-phone">
557 <button class="mdl-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect mdl-js-button mdlext-js-menu-button">
558 <span class="mdlext-menu-button__caption">Select a size</span>
559 <i class="mdlext-aria-expanded-plus-minus"></i>
560 </button>
561 <ul class="mdlext-menu"
562 role="menu"
563 hidden >
564 <li class="mdlext-menu__item" role="menuitem">Small</li>
565 <li class="mdlext-menu__item" role="menuitem">Medium</li>
566 <li class="mdlext-menu__item" role="menuitem">Large</li>
567 </ul>
568 </div>
569 </div>
570</div>
571<script>
572 document.querySelector('#a-grid-with-menu-buttons').addEventListener('menuselect', function(event) {
573 event.target.querySelector('span').innerHTML = 'Size: ' + event.detail.source.innerHTML;
574 });
575</script>
576
577<div style="margin-bottom:256px;"></div>
578
579<!--
580https://www.w3.org/TR/wai-aria-practices/#menubutton
581http://w3c.github.io/aria-practices/examples/menu-button/menu-button-1.html
582http://w3c.github.io/aria-practices/examples/menu-button/menu-button-2.html
583http://tympanus.net/codrops/2012/10/04/custom-drop-down-list-styling/
584http://www.slideshare.net/webaxe/html5-dev-con-2012-aria-widget
585http://terrillthompson.com/blog/474
586https://github.com/davidtheclark/react-aria-menubutton
587https://codepen.io/tiffanytse/pen/Dkvtr
588https://codepen.io/andytran/pen/vLNGvN
589https://codepen.io/dapacreative/pen/WQoLzb
590https://codepen.io/gabrieltomescu/pen/ZGGyPK
591https://codepen.io/Idered/pen/vowrB
592https://codepen.io/Stedesign/pen/DbAJh
593http://markbirbeck.com/2015/10/14/a-mixin-approach-to-material-design-lite-using-sass/
594-->