Calendar meets WCAG 2.2 level AA when used as described on these pages. It follows the Date picker dialog pattern of the WAI-ARIA Authoring Practices for the grid of days.
Keyboard
| Key |
Action |
| Tab |
Moves focus to the previous and next buttons, then into the grid, on the picked day or today. |
| ← → |
Moves one day. |
| ↑ ↓ |
Moves one week. |
| Page Up Page Down |
Moves one month. With Shift, one year. |
| Home End |
Moves to the first or last day of the week. |
| Enter Space |
Picks the focused day. |
What Calendar gives you
- The calendar is named by the month it shows, with a hidden level-2 heading of the same text.
- The days are a table with weekday column headers. Each cell is a
gridcell with aria-selected when its day is picked.
- Each day is a button named by its full date, with
aria-disabled when it can’t be picked. Only one day is in the tab order at a time.
- A visible focus ring on the focused day and on the buttons (
color.border.focus, 2 px, 2 px away).
- Unavailable days are struck through as well as greyed, so they don’t depend on colour (WCAG 1.4.1).
- Day text 7:1 or more on the surface; text on the selected day is
text.inverse on the primary fill.
What your team does
- Give the picker a visible label, and point the trigger button at it (
aria-labelledby), as the date picker example does.
- Pass the page language to
locale.
- Say on the page why some days can’t be picked.
- In a popover, set
initial-focus so the keyboard starts in the grid.
WCAG criteria
| Criterion |
Level |
How |
| 1.3.1 Info and Relationships |
A |
Grid, column headers, full date per day |
| 1.4.1 Use of Color |
A |
Today has an edge; unavailable days are struck through |
| 1.4.11 Non-text Contrast |
AA |
Focus ring and today’s edge |
| 2.1.1 Keyboard |
A |
Arrow keys, Page Up, Page Down, Home, End |
| 2.4.7 Focus Visible |
AA |
Focus ring on the focused day |
| 4.1.2 Name, Role, Value |
A |
Day buttons named by their date; aria-selected, aria-disabled |