Accessibility in Blazor Datetime Picker Component
17 Apr 20247 minutes to read
The web accessibility defines a way to make web content and web applications more accessible to disabled people. It especially helps the dynamic content change and advanced user interface components developed with Ajax, HTML, JavaScript, and related technologies.
The Blazor DateTimePicker component followed the accessibility guidelines and standards, including ADA, Section 508, WCAG 2.2 standards, and WCAG roles that are commonly used to evaluate accessibility.
The accessibility compliance for the Blazor DateTimePicker component is outlined below.
Accessibility Criteria | Compatibility |
---|---|
WCAG 2.2 Support | |
Section 508 Support | |
Screen Reader Support | |
Right-To-Left Support | |
Color Contrast | |
Mobile Device Support | |
Keyboard Navigation Support | |
Axe-core Accessibility Validation |
WAI-ARIA attributes
Blazor DateTimePicker provides built-in compliance with the WAI-ARIA specifications. WAI-ARIA
support is achieved through the attributes like aria-expanded
, aria-disabled
, aria-activedescendant
applied to the input element.
To learn about the accessibility of Calendar, refer to the Calendar’s Accessibility section.
It helps to provide information about the widget for assistive technology to the disabled person in screen reader.
-
aria-expanded: Attribute indicates the state of a collapsible element.
-
aria-disabled: Attribute indicates the disabled state of this DateTimePicker component.
-
aria-activedescendent: Attribute helps in managing the current active child of the DateTimePicker component.
Keyboard interaction
You can use the following keys to interact with the Blazor DateTimePicker. This component implements the keyboard navigation support by following the WAI-ARIA practices.
Blazor DateTimePicker supports the below list of shortcut keys:
Input navigation
Before opening the popup, use the following keys to control the popup element.
Keys | Description |
---|---|
Alt + Down Arrow | Opens the select popup |
Alt + Down Arrow + Alt + Down Arrow | Toggles between two popups |
Calendar navigation
Use the following keys to interact with the Calendar after the DatePicker popup has opened:
Keys | Description |
---|---|
Upper Arrow | Focuses the previous week date. |
Down Arrow | Focuses the next week date. |
Left Arrow | Focuses the previous date. |
Right Arrow | Focuses the next date. |
Home | Focuses the first date in the month. |
End | Focuses the last date in the month. |
Page Up | Focuses the same date in the previous month. |
Page Down | Focuses the same date in the next month. |
Enter | Selects the currently focused date. |
Shift + Page Up | Focuses the same date in the previous year. |
Shift + Page Down | Focuses the same date in the previous year. |
Control + Upper Arrow | Moves into the inner level of view like month-year, year-decade |
Control + Down Arrow | Moves out from the depth level view like decade-year, year-month |
Control +Home | Focuses the starting date in the current year. |
Control +End | Focuses the ending date in the current year. |
Use the following shortcut keys to interact with the TimePicker after the TimePicker Popup has opened:
Keys | Description |
---|---|
Upper Arrow | Navigates and selects the previous item. |
Down Arrow | Navigates and selects the next item. |
Left Arrow | Moves the cursor towards arrow key pressed direction. |
Right Arrow | Moves the cursor towards arrow key pressed direction. |
Home | Navigates and selects the first item. |
End | Navigates and selects the last item. |
Enter | Selects the currently focused item and close the popup. |
Alt + Upper Arrow | Closes the popup. |
Alt + Down Arrow | Opens the popup. |
Esc | Closes the popup. |
NOTE
To focus out the DateTimePicker component, use the
t
keys. For additional information about native event, click here.
@using Syncfusion.Blazor.Calendars
<SfDateTimePicker TValue="DateTime?" @onkeypress="@(e => KeyPressed(e))" @ref="DateTimeObj"></SfDateTimePicker>
@code {
public SfDateTimePicker<DateTime?> DateTimeObj;
public void KeyPressed(KeyboardEventArgs args)
{
if (args.Key == "t")
{
this.DateTimeObj.FocusOutAsync();
}
}
}
Ensuring accessibility
The Blazor DateTimePicker component’s accessibility levels are ensured through an axe-core software tool during automated testing.
The accessibility compliance of the DateTimePicker component is shown in the following sample. Open the sample in a new window to evaluate the accessibility of the DateTimePicker component with accessibility tools.