Accessibility in EJ2 TypeScript Daterangepicker control
24 Jan 20248 minutes to read
The DateRangePicker 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 DateRangePicker component is outlined below.
WAI-ARIA attributes
The web accessibility makes web content and web applications more accessible for people with disabilities. It especially helps in dynamic content change and development of advanced user interface controls with AJAX, HTML, JavaScript, and related technologies. DateRangePicker provides built-in compliance with WAI-ARIA specifications. WAI-ARIA support is achieved through the attributes like aria-expanded
, aria-disabled
, and aria-activedescendant
applied as an input element.
To know about the accessibility of Calendar, refer to the Calendar’s Accessibility section.
It helps people with disabilities by providing information about the widget for assistive technology in the screen readers. DateRangePicker component contains grid role and grid cell for each day cell.
-
Aria-expanded: Indicates the currently selected date of the DateRangePicker component.
-
Aria-disabled: Indicates the disabled state of the DateRangePicker component.
Keyboard Interaction
Use the below keys to interact with the DateRangePicker.
This component implements the keyboard navigation support by following the WAI-ARIA practices.
It supports the following list of shortcut keys:
Input Navigation
Before opening the popup, use the following list of keys to control the popup element.
Press | To do this |
---|---|
Alt + Down Arrow | Opens the popup. |
Alt + Up Arrow | Closes the popup. |
Esc | Closes the popup. |
Calendar Navigation
Use the following list of keys to navigate the currently focused Calendar after the popup has opened.
Press | To do this |
---|---|
Upper Arrow | Focuses the same day of the previous week. |
Down Arrow | Focuses the same day of the next week. |
Left Arrow | Focuses the day before. |
Right Arrow | Focuses the next day. |
Home | Focuses the first day of the month. |
End | Focuses the last day of the month. |
Page Up | Focuses the same date of the previous month. |
Page Down | Focuses the same date of the next month. |
Enter | Selects the currently focused date. |
Shift + Page Up | Focuses the same date for the previous year. |
Shift + Page Down | Focuses the same date for the next year. |
Control + Home | Focuses the first date of the current year. |
Control + End | Focuses the last date of the current year. |
Alt + Right | Focuses through out the pop-up container in forward direction. |
Alt + Left | Focuses through out the pop-up container in backward direction. |
To focus the DateRangePicker component, use the
alt+t
keys.
import { DateRangePicker } from '@syncfusion/ej2-calendars';
// creates a DateRangePicker component
let daterangeObject: DateRangePicker = new DateRangePicker({
// sets the placeholder
placeholder: 'Select a range'
});
daterangeObject.appendTo('#element');
document.onkeyup = function (e) {
if (e.altKey && e.keyCode === 84 /* t */) {
// press alt+t to focus the component.
daterangeObject.element.focus();
}
};
<!DOCTYPE html>
<html lang="en">
<head>
<title>Essential JS 2 DateRangePicker control</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="styles.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-calendars/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<input id='element' type="text" />
</div>
</body>
</html>
Ensuring accessibility
The DateRangePicker component’s accessibility levels are ensured through an accessibility-checker and axe-core software tools during automated testing.
The accessibility compliance of the DateRangePicker component is shown in the following sample. Open the sample in a new window to evaluate the accessibility of the DateRangePicker component with accessibility tools.