/
combobox-datepicker.html
724 lines (694 loc) · 33.6 KB
/
combobox-datepicker.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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Date Picker Combobox Example</title>
<!-- Core JS and CSS shared by all examples -->
<link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2016/base.css">
<link rel="stylesheet" href="../../../shared/css/core.css">
<script src="../../../shared/js/examples.js"></script>
<script src="../../../shared/js/highlight.pack.js"></script>
<script src="../../../shared/js/app.js"></script>
<script src="../../../shared/js/skipto.js"></script>
<!-- JS and CSS for this example -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<link href="css/combobox-datepicker.css" rel="stylesheet">
<script src="js/combobox-datepicker.js"></script>
</head>
<body>
<nav aria-label="Related Links" class="feedback">
<ul>
<li><a href="https://github.com/w3c/aria-practices/projects/7">Related Issues</a></li>
<li><a href="../combobox-pattern.html">Design Pattern</a></li>
</ul>
</nav>
<main>
<h1>Date Picker Combobox Example</h1>
<section>
<h2>About This Example</h2>
<p>
The below date picker demonstrates an implementation of the <a href="../combobox-pattern.html">Combobox Pattern</a> that opens a dialog.
The date picker dialog is opened by activating the choose date button or by moving keyboard focus to the combobox and pressing <kbd>Down Arrow</kbd> or <kbd>Alt + Down Arrow</kbd>.
The dialog contains an implementation of the <a href="../../grid/grid-pattern.html">grid pattern</a> for displaying a calendar and enabling selection of a date.
Additional buttons in the dialog are available for changing the month and year shown in the grid.
</p>
<p>Similar examples include:</p>
<ul>
<li><a href="../../dialog-modal/examples/datepicker-dialog.html">Date Picker Dialog example</a>: Demonstrates a dialog containing a calendar grid for choosing a date.</li>
<li><a href="combobox-select-only.html">Select-Only Combobox</a>: A single-select combobox with no text input that is functionally similar to an HTML <code>select</code> element.</li>
<li><a href="combobox-autocomplete-both.html">Editable Combobox with Both List and Inline Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as "list with inline autocomplete".</li>
<li><a href="combobox-autocomplete-list.html">Editable Combobox with List Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as "list with manual selection".</li>
<li><a href="combobox-autocomplete-none.html">Editable Combobox Without Autocomplete</a>: An editable combobox that demonstrates the behavior associated with <code>aria-autocomplete=none</code>.</li>
<li><a href="grid-combo.html">Editable Combobox with Grid Popup</a>: An editable combobox that presents suggestions in a grid, enabling users to navigate descriptive information about each suggestion.</li>
</ul>
</section>
<section>
<div class="example-header">
<h2 id="ex_label">Example</h2>
</div>
<div role="separator" id="ex_start_sep" aria-labelledby="ex_start_sep ex_label" aria-label="Start of"></div>
<div id="ex1">
<div id="myDatepicker" class="combobox-datepicker">
<div class="label">
<label id="id-label-1" for="cb-textbox-1"> Date </label>
</div>
<div class="group">
<input type="text" id="cb-textbox-1" aria-autocomplete="none" role="combobox" aria-expanded="false" aria-haspopup="dialog" aria-controls="cb-dialog-1" aria-describedby="cb-description-1">
<span class="desc" id="cb-description-1">(date format: mm/dd/yyyy)</span>
<button type="button" class="arrow" tabindex="-1" aria-label="Choose Date">
<span>
<svg width="18" height="16" aria-hidden="true" focusable="false">
<polygon points="2,4 16,4 9,14"></polygon>
</svg>
</span>
</button>
</div>
<div id="cb-dialog-1" class="dialog" role="dialog" aria-modal="true" aria-label="Choose Date">
<div class="header">
<button type="button" class="prev-year" aria-label="previous year">
<span class="fas fa-angle-double-left fa-lg"></span>
</button>
<button type="button" class="prev-month" aria-label="previous month">
<span class="fas fa-angle-left fa-lg"></span>
</button>
<h2 id="cb-grid-label" class="month-year" aria-live="polite">December 2020</h2>
<button type="button" class="next-month" aria-label="next month">
<span class="fas fa-angle-right fa-lg"></span>
</button>
<button type="button" class="next-year" aria-label="next year">
<span class="fas fa-angle-double-right fa-lg"></span>
</button>
</div>
<table class="dates" role="grid" aria-labelledby="cb-grid-label">
<thead>
<tr>
<th scope="col" abbr="Sunday">Su</th>
<th scope="col" abbr="Monday">Mo</th>
<th scope="col" abbr="Tuesday">Tu</th>
<th scope="col" abbr="Wednesday">We</th>
<th scope="col" abbr="Thursday">Th</th>
<th scope="col" abbr="Friday">Fr</th>
<th scope="col" abbr="Saturday">Sa</th>
</tr>
</thead>
<tbody>
<tr>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td tabindex="-1" data-date="2020-02-01">1</td>
</tr>
<tr>
<td tabindex="-1" data-date="2020-02-02">2</td>
<td tabindex="-1" data-date="2020-02-03">3</td>
<td tabindex="-1" data-date="2020-02-04">4</td>
<td tabindex="-1" data-date="2020-02-05">5</td>
<td tabindex="-1" data-date="2020-02-06">6</td>
<td tabindex="-1" data-date="2020-02-07">7</td>
<td tabindex="-1" data-date="2020-02-08">8</td>
</tr>
<tr>
<td tabindex="-1" data-date="2020-02-09">9</td>
<td tabindex="-1" data-date="2020-02-10">10</td>
<td tabindex="-1" data-date="2020-02-11">11</td>
<td tabindex="-1" data-date="2020-02-12">12</td>
<td tabindex="-1" data-date="2020-02-13">13</td>
<td role="gridcell" aria-selected="true" data-date="2020-02-14">14</td>
<td tabindex="-1" data-date="2020-02-15">15</td>
</tr>
<tr>
<td tabindex="-1" data-date="2020-02-16">16</td>
<td tabindex="-1" data-date="2020-02-17">17</td>
<td tabindex="-1" data-date="2020-02-18">18</td>
<td tabindex="-1" data-date="2020-02-19">19</td>
<td tabindex="-1" data-date="2020-02-20">20</td>
<td tabindex="-1" data-date="2020-02-21">21</td>
<td tabindex="-1" data-date="2020-02-22">22</td>
</tr>
<tr>
<td tabindex="-1" data-date="2020-02-23">23</td>
<td tabindex="-1" data-date="2020-02-24">24</td>
<td tabindex="-1" data-date="2020-02-25">25</td>
<td tabindex="-1" data-date="2020-02-26">26</td>
<td tabindex="-1" data-date="2020-02-27">27</td>
<td tabindex="-1" data-date="2020-02-28">28</td>
<td tabindex="-1" data-date="2020-02-29">29</td>
</tr>
<tr>
<td tabindex="-1" data-date="2020-02-30">30</td>
<td tabindex="-1" data-date="2020-02-31">31</td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
<td class="disabled" tabindex="-1"></td>
</tr>
</tbody>
</table>
<div class="dialog-ok-cancel-group">
<button class="dialog-button" value="cancel">Cancel</button>
<button class="dialog-button" value="ok">OK</button>
</div>
<div class="dialog-message" aria-live="polite"></div>
</div>
</div>
</div>
<div role="separator" id="ex_end_sep" aria-labelledby="ex_end_sep ex_label" aria-label="End of"></div>
</section>
<section>
<h2>Accessibility Features</h2>
<ul>
<li>The description of the date format is associated with the combobox via <code>aria-describedby</code>, making it available to assistive technologies as an accessible description.</li>
<li>
While the down arrow icon is excluded from the <kbd>Tab</kbd> sequence as specified in the <code>combobox</code> design pattern, it is made accessible to assistive technologies as the Choose Date button.
This enables assistive technology users who might not have a keyboard, e.g., someone using a touch-based screen reader, to open the date picker dialog.
</li>
<li>In the dialog, shortcut keys are assigned to the additional buttons for changing the month and year displayed in the calendar.</li>
<li>
Keyboard help is displayed at the bottom of the dialog.
A live region is used to announce it to screen reader users when focus moves into the grid.
</li>
<li>The calendar heading displaying the month and year is marked up as a live region so screen reader users get feedback from the buttons and keyboard commands that change the month and year.</li>
<li>
To facilitate compact visual design in the calendar, the day names in the column headers are abbreviated to two characters.
However, this makes it more difficult for screen reader users to understand the day names.
So, full day names are provided to assistive technologies in the HTML <code>abbr</code> attribute on the column headers, enabling screen readers to announce the full names when users navigate the grid.
</li>
<li>
Focus and hover styling of the controls support operating system high contrast settings via the CSS border property:
<ul>
<li>When a button or date cell receives focus a border is added.</li>
<li>When hovering over a button or date cell with a pointing device a border is added.</li>
<li>By default, buttons and date cells do not have a border; padding provides a placeholder space for focus and hover styling.</li>
</ul>
</li>
</ul>
</section>
<section>
<h2 id="kbd_label">Keyboard Support</h2>
<section>
<h3 id="kbd_label_1">Combobox</h3>
<table aria-labelledby="kbd_label_1 kbd_label" class="def">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr data-test-id="combobox-down-arrow">
<th><kbd>Down Arrow</kbd>,<br><kbd>ALT + Down Arrow</kbd></th>
<td>
<ul>
<li>Open the date picker dialog.</li>
<li>
If the combobox contains a valid date, moves focus to that date in the calendar grid.
Otherwise, moves focus to current date, i.e., today's date.
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="kbd_label_3">Date Picker Dialog</h3>
<table aria-labelledby="kbd_label_3 kbd_label" class="def">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr data-test-id="dialog-esc">
<th><kbd>ESC</kbd></th>
<td>Closes the dialog and moves focus to the combobox.</td>
</tr>
<tr data-test-id="dialog-tab">
<th><kbd>TAB</kbd></th>
<td>
<ul>
<li>Moves focus to next element in the dialog <kbd>Tab</kbd> sequence.</li>
<li>Note that, as specified in the <a href="../../grid/grid-pattern.html">Grid Pattern</a>, only one element in the calendar grid is in the <kbd>Tab</kbd> sequence.</li>
<li>If focus is on the last button (i.e., "OK"), moves focus to the first button (i.e. "Previous Year").</li>
</ul>
</td>
</tr>
<tr data-test-id="dialog-shift-tab">
<th><kbd>Shift + TAB</kbd></th>
<td>
<ul>
<li>Moves focus to previous element in the dialog <kbd>Tab</kbd> sequence.</li>
<li>Note that, as specified in the <a href="../../grid/grid-pattern.html">Grid Pattern</a>, only one element in the calendar grid is in the <kbd>Tab</kbd> sequence.</li>
<li>If focus is on the first button (i.e., "Previous Year"), moves focus to the last button (i.e. "OK").</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="kbd_label_4">Date Picker Dialog: Calendar Buttons</h3>
<table aria-labelledby="kbd_label_4 kbd_label" class="def">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr data-test-id="month-year-button-space-return">
<th>
<kbd>Space</kbd>,<br>
<kbd>Enter</kbd>
</th>
<td>Change the month and/or year displayed in the calendar grid.</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="kbd_label_5">Date Picker Dialog: Date Grid</h3>
<table aria-labelledby="kbd_label_5 kbd_label" class="def">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr data-test-id="grid-space">
<th><kbd>Space</kbd></th>
<td>
<ul>
<li>Selects the date.</li>
<li>Updates the value of the <code>combobox</code> with the selected date.</li>
</ul>
</td>
</tr>
<tr data-test-id="grid-enter">
<th><kbd>Enter</kbd></th>
<td>
<ul>
<li>Selects the date.</li>
<li>Updates the value of the <code>combobox</code> with the selected date.</li>
<li>Closes the dialog and moves focus to the <code>combobox</code>.</li>
</ul>
</td>
</tr>
<tr data-test-id="grid-up-arrow">
<th><kbd>Up Arrow</kbd></th>
<td>Moves focus to the same day of the previous week.</td>
</tr>
<tr data-test-id="grid-down-arrow">
<th><kbd>Down Arrow</kbd></th>
<td>Moves focus to the same day of the next week.</td>
</tr>
<tr data-test-id="grid-right-arrow">
<th><kbd>Right Arrow</kbd></th>
<td>Moves focus to the next day.</td>
</tr>
<tr data-test-id="grid-left-arrow">
<th><kbd>Left Arrow</kbd></th>
<td>Moves focus to the previous day.</td>
</tr>
<tr data-test-id="grid-home">
<th><kbd>Home</kbd></th>
<td>Moves focus to the first day (e.g. Sunday) of the current week.</td>
</tr>
<tr data-test-id="grid-end">
<th><kbd>End</kbd></th>
<td>Moves focus to the last day (e.g. Saturday) of the current week.</td>
</tr>
<tr data-test-id="grid-pageup">
<th><kbd>PageUp</kbd></th>
<td>
<ul>
<li>Changes the grid of dates to the previous month.</li>
<li>
Moves focus to the day of the month that has the same number.
If that day does not exist, moves focus to the last day of the month.
</li>
</ul>
</td>
</tr>
<tr data-test-id="grid-shift-pageup">
<th>
<kbd>Shift</kbd>+<br>
<kbd>PageUp</kbd>
</th>
<td>
<ul>
<li>Changes the grid of dates to the same month in the previous year.</li>
<li>
Moves focus to the day of the month that has the same number.
If that day does not exist, moves focus to the last day of the month.
</li>
</ul>
</td>
</tr>
<tr data-test-id="grid-pagedown">
<th><kbd>PageDown</kbd></th>
<td>
<ul>
<li>Changes the grid of dates to the next month.</li>
<li>
Moves focus to the day of the month that has the same number.
If that day does not exist, moves focus to the last day of the month.
</li>
</ul>
</td>
</tr>
<tr data-test-id="grid-shift-pagedown">
<th>
<kbd>Shift</kbd>+<br>
<kbd>PageDown</kbd>
</th>
<td>
<ul>
<li>Changes the grid of dates to the same month in the next year.</li>
<li>
Moves focus to the day of the month that has the same number.
If that day does not exist, moves focus to the last day of the month.
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="kbd_label_6">Date Picker Dialog: OK and Cancel Buttons</h3>
<table aria-labelledby="kbd_label_6 kbd_label" class="def">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr data-test-id="okay-cancel-button-space-return">
<th>
<kbd>Space</kbd>,<br>
<kbd>Enter</kbd>
</th>
<td>
Activates the button:
<ul>
<li>"Cancel": Closes the dialog, moves focus to combobox, does not update combobox value.</li>
<li>"OK": Closes the dialog, moves focus to combobox, updates date in combobox.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
</section>
<section>
<h2 id="rps_label">Role, Property, State, and Tabindex Attributes</h2>
<section>
<h3 id="rps_label_combobox">Combobox</h3>
<table aria-labelledby="rps_label_combobox rps_label" class="data attributes">
<thead>
<tr>
<th scope="col">Role</th>
<th scope="col">Attribute</th>
<th scope="col">Element</th>
<th scope="col">Usage</th>
</tr>
</thead>
<tbody>
<tr data-test-id="textbox-role">
<th scope="row"><code>combobox</code></th>
<td></td>
<td><code>input</code></td>
<td>Identifies the <code>input</code> element as a combobox.</td>
</tr>
<tr data-test-id="textbox-aria-haspopup">
<td></td>
<th scope="row"><code>aria-haspopup="dialog"</code></th>
<td><code>input</code></td>
<td>Indicates that the combobox opens a dialog.</td>
</tr>
<tr data-test-id="textbox-aria-expanded-false">
<td></td>
<th scope="row"><code>aria-expanded="false"</code></th>
<td><code>input</code></td>
<td>Indicates that the combobox is collapsed, i.e., the "Choose Date" dialog is not displayed.</td>
</tr>
<tr data-test-id="textbox-aria-expanded-true">
<td></td>
<th scope="row"><code>aria-expanded="true"</code></th>
<td><code>input</code></td>
<td>Indicates that the combobox is expanded, i.e., the "Choose Date" dialog is open.</td>
</tr>
<tr data-test-id="textbox-aria-autocomplete">
<td></td>
<th scope="row"><code>aria-autocomplete="none"</code></th>
<td><code>input</code></td>
<td>Indicates the combobox does not support autocomplete.</td>
</tr>
<tr data-test-id="textbox-aria-controls">
<td></td>
<th scope="row"><code>aria-controls="IDREF"</code></th>
<td><code>input</code></td>
<td>Identifies the element controlled by the combobox.</td>
</tr>
<tr data-test-id="textbox-aria-describedby">
<td></td>
<th scope="row"><code>aria-describedby="IDREF"</code></th>
<td><code>input</code></td>
<td>Identifies the element that provides an accessible description for the combobox, enabling assistive technologies to associate the date format description with the input.</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="rps_label_2">Choose Date Button</h3>
<table aria-labelledby="rps_label_2 rps_label" class="data attributes">
<thead>
<tr>
<th scope="col">Role</th>
<th scope="col">Attribute</th>
<th scope="col">Element</th>
<th scope="col">Usage</th>
</tr>
</thead>
<tbody>
<tr data-test-id="calendar-button-tabindex">
<td></td>
<th scope="row"><code>tabindex="-1"</code></th>
<td><code>button</code></td>
<td>Excludes the button (i.e., the down arrow icon) from the <kbd>Tab</kbd> sequence as specified by the combobox design pattern.</td>
</tr>
<tr data-test-id="calendar-button-aria-label">
<td></td>
<th scope="row"><code>aria-label="string"</code></th>
<td><code>button</code></td>
<td>Defines the accessible name as "Choose Date", which matches the title of the dialog opened by activating the button.</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="rps_label_3">Date Picker Dialog</h3>
<table aria-labelledby="rps_label_3 rps_label" class="data attributes">
<thead>
<tr>
<th scope="col">Role</th>
<th scope="col">Attribute</th>
<th scope="col">Element</th>
<th scope="col">Usage</th>
</tr>
</thead>
<tbody>
<tr data-test-id="dialog-role">
<th scope="row"><code>dialog</code></th>
<td></td>
<td>
<code>div</code>
</td>
<td>Identifies the element as a dialog.</td>
</tr>
<tr data-test-id="dialog-aria-modal">
<td></td>
<th scope="row"><code>aria-modal="true"</code></th>
<td><code>div</code></td>
<td>Indicates the dialog is modal.</td>
</tr>
<tr data-test-id="dialog-aria-label">
<td></td>
<th scope="row"><code>aria-label="Choose Date"</code></th>
<td><code>div</code></td>
<td>Defines the accessible name for the dialog.</td>
</tr>
<tr data-test-id="calendar-navigation-aria-live">
<td></td>
<th scope="row"><code>aria-live="polite"</code></th>
<td><code>h2</code></td>
<td>
<ul>
<li>Indicates that screen readers should automatically announce the element containing the currently displayed month and year when they change.</li>
<li>The <code>polite</code> value indicates that other announcements should not be interrupted.</li>
</ul>
</td>
</tr>
<tr data-test-id="dialog-aria-live">
<td></td>
<th scope="row"><code>aria-live="polite"</code></th>
<td><code>div</code></td>
<td>
<ul>
<li>Indicates the element that displays information about keyboard commands for navigating the grid should be automatically announced by screen readers.</li>
<li>The script slightly delays display of the information, so screen readers are more likely to announce it after announcing focus change events.</li>
<li>The <code>polite</code> value indicates that other announcements should not be interrupted.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="rps_label_4">Date Picker Dialog: Calendar Navigation Buttons</h3>
<table aria-labelledby="rps_label_4 rps_label" class="data attributes">
<thead>
<tr>
<th scope="col">Role</th>
<th scope="col">Attribute</th>
<th scope="col">Element</th>
<th scope="col">Usage</th>
</tr>
</thead>
<tbody>
<tr data-test-id="calendar-navigation-button-aria-label">
<td></td>
<th scope="row"><code>aria-label="<em>String</em>"</code></th>
<td><code>button</code></td>
<td>Defines the accessible name of the button (e.g. "Next Year").</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="rps_label_5">Date Picker Dialog: Date Grid</h3>
<table aria-labelledby="rps_label_5 rps_label" class="data attributes">
<thead>
<tr>
<th scope="col">Role</th>
<th scope="col">Attribute</th>
<th scope="col">Element</th>
<th scope="col">Usage</th>
</tr>
</thead>
<tbody>
<tr data-test-id="grid-role">
<th scope="row"><code>grid</code></th>
<td></td>
<td>
<code>table</code>
</td>
<td>
<ul>
<li>Identifies the <code>table</code> element as a <code>grid</code> widget.</li>
<li>Since the <code>grid</code> role is applied to a <code>table</code> element, the <code>row</code>, <code>columnheader</code>, and <code>gridcell</code> roles do not need to be specified because they are implied by <code>tr</code>, <code>th</code>, and <code>td</code> tags.</li>
</ul>
</td>
</tr>
<tr data-test-id="grid-aria-labelledby">
<td></td>
<th scope="row"><code>aria-labelledby="IDREF"</code></th>
<td><code>table</code></td>
<td>Identifies the element that provides the accessible name for the <code>grid</code>, which is the <code>h2</code> that shows the month and year of the dates displayed in the grid.</td>
</tr>
<tr data-test-id="gridcell-tabindex">
<td></td>
<th scope="row">
<code>tabindex="0"</code>
</th>
<td>
<code>td</code>
</td>
<td>
<ul>
<li>Makes the gridcell focusable and includes it in the dialog <kbd>Tab</kbd> sequence.</li>
<li>Set dynamically by the JavaScript when the element is to be included in the dialog <kbd>Tab</kbd> sequence.</li>
<li>At any given time, only one gridcell within the grid is in the dialog <kbd>Tab</kbd> sequence.</li>
<li>
This approach to managing focus is described in the section on
<a href="../../../practices/keyboard-interface/keyboard-interface-practice.html#kbd_roving_tabindex">Managing Focus Within Components Using a Roving tabindex</a>.
</li>
</ul>
</td>
</tr>
<!-- The regression test for tabindex=0 tests for tabindex=-1 -->
<tr data-test-id="gridcell-tabindex">
<td></td>
<th scope="row">
<code>tabindex="-1"</code>
</th>
<td>
<code>td</code>
</td>
<td>
<ul>
<li>Makes the gridcell focusable and excludes it from the dialog <kbd>Tab</kbd> sequence.</li>
<li>Changed dynamically to <code>0</code> by the JavaScript when the gridcell is to be included in the dialog <kbd>Tab</kbd> sequence.</li>
<li>At any given time, only one gridcell within the grid is in the dialog <kbd>Tab</kbd> sequence.</li>
<li>
This approach to managing focus is described in the section on
<a href="../../../practices/keyboard-interface/keyboard-interface-practice.html#kbd_roving_tabindex">Managing Focus Within Components Using a Roving tabindex</a>.
</li>
</ul>
</td>
</tr>
<tr data-test-id="gridcell-aria-selected">
<td></td>
<th scope="row"><code>aria-selected="true"</code></th>
<td><code>td</code></td>
<td>
<ul>
<li>Indicates the cell is selected.</li>
<li>Set on the gridcell representing the current value of the combobox; no other gridcells have <code>aria-selected</code> specified.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>
<strong>Note:</strong> Since the names of the days of the week in the column headers are abbreviated to two characters, they may be difficult to understand when announced by a screen reader.
An alternative column header name can be provided to screen readers by applying the <code>abbr</code> attribute to the <code>th</code> elements.
So, each <code>th</code> element includes an <code>abbr</code> attribute containing the full spelling of the name of the day for that column.
</p>
</section>
</section>
<section>
<h2>Javascript and CSS Source Code</h2>
<ul id="css_js_files">
<li>
CSS:
<a href="css/combobox-datepicker.css" type="text/css">combobox-datepicker.css</a>
</li>
<li>
Javascript:
<a href="js/combobox-datepicker.js" type="text/javascript">combobox-datepicker.js</a>
</li>
</ul>
</section>
<section>
<h2 id="sc1_label">HTML Source Code</h2>
<div role="separator" id="sc1_start_sep" aria-labelledby="sc1_start_sep sc1_label" aria-label="Start of"></div>
<pre><code id="sc1"></code></pre>
<div role="separator" id="sc1_end_sep" aria-labelledby="sc1_end_sep sc1_label" aria-label="End of"></div>
<script>
sourceCode.add('sc1', 'ex1', 'ex_label', 'css_js_files');
sourceCode.make();
</script>
</section>
</main>
</body>
</html>