Value to describe the component can either be provided via label tag combined with inputId prop or using aria-labelledby, aria-label props. The input element has combobox role in addition to aria-autocomplete as "none", aria-haspopup as "dialog" and aria-expanded attributes. The relation between the input and the popup is created with aria-controls attribute that refers to the id of the popup.
The optional datepicker button requires includes aria-haspopup, aria-expanded for states along with aria-controls to define the relation between the popup and the button. The value to read is retrieved from the
chooseDate key of the aria property from the
Popup has a dialog role along with aria-modal and aria-label. The navigation buttons at the header has an aria-label retrieved from the prevYear, nextYear, prevMonth, nextMonth, prevDecade and nextDecade keys of the locale aria API. Similarly month picker button uses the chooseMonth and year picker button uses the chooseYear keys.
Main date table uses grid role that contains th elements with col as the scope along with abbr tag resolving to the full name of the month. Each date cell has an aria-label referring to the full date value. Buttons at the footer utilize their readable labels as aria-label as well. Selected date also receives the aria-selected attribute.
Timepicker spinner buttons get their labels for aria-label from the aria locale API using the prevHour, nextHour, prevMinute, nextMinute, prevSecond, nextSecond, am and pm keys.
DatePicker also includes a hidden section that is only available to screen readers with aria-live as "polite". This element is updated when the selected date changes to instruct the user about the current date selected.
Key | Function |
---|---|
space | Opens popup and moves focus to the selected date, if there is none focuses on today. |
enter | Opens popup and moves focus to the selected date, if there is none focuses on today. |
Key | Function |
---|---|
escape | Closes the popup and moves focus to the input element. |
tab | Moves focus to the next focusable element within the popup. |
shift + tab | Moves focus to the next focusable element within the popup. |
Key | Function |
---|---|
enter | Triggers the button action. |
space | Triggers the button action. |
Key | Function |
---|---|
enter | Selects the date, closes the popup and moves focus to the input element. |
space | Closes the popup and moves focus to the input element. |
up arrow | Moves focus to the same day of the previous week. |
alt + up arrow | Closes the popup and moves focus to the input element. |
down arrow | Moves focus to the same day of the next week. |
right arrow | Moves focus to the next day. |
left arrow | Moves focus to the previous day. |
home | Moves focus to the first day of the current week. |
end | Moves focus to the last day of the current week. |
page up | Changes the date to previous month in date picker mode. Moves to previous year in month picker mode and previous decade in year picker. |
shift + page up | Changes the date to previous year in date picker mode. Has no effect in month or year picker. |
page down | Changes the date to next month in date picker mode. Moves to next year in month picker mode and next decade in year picker. |
shift + page down | Changes the date to next year in date picker mode. Has no effect in month or year picker. |
Key | Function |
---|---|
enter | Triggers the button action. |
space | Triggers the button action. |