Accessibility in Angular Daterangepicker component

27 Apr 20246 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.

Accessibility Criteria Compatibility
WCAG 2.2 Support Intermediate
Section 508 Support Intermediate
Screen Reader Support Yes
Right-To-Left Support Yes
Color Contrast Yes
Mobile Device Support Yes
Keyboard Navigation Support Yes
Accessibility Checker Validation Yes
Axe-core Accessibility Validation Yes
Yes - All features of the component meet the requirement.
Intermediate - Some features of the component do not meet the requirement.
No - The component does not meet the requirement.

WAI-ARIA attributes

The web accessibility makes web content and web applications more accessible for disabled people.
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 supports is achieved through the attributes like aria-expanded, aria-disabled, aria-activedescendant applied to the input element.

To know about the accessibility of Calendar refer to the Calendar’s Accessibility section.

It helps disabled persons 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: attributes indicates the state of a collapsible element.

  • Aria-disabled: Indicates the disabled state of the DateRangePicker component.

Keyboard Interaction

You can use the following 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 below list of keys to control the popup element.

Press To do this
Alt + Down Arrow Opens the popup.
Alt + Up Arrow Closes the popup (if component’s input element is in focused state).
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 { NgModule } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { BrowserModule } from '@angular/platform-browser'
import { DateRangePickerModule } from '@syncfusion/ej2-angular-calendars'



import { Component,HostListener,ViewChild } from '@angular/core';
import { CalendarComponent, DateRangePickerComponent } from '@syncfusion/ej2-angular-calendars';

@Component({
imports: [
        
        FormsModule,
        DateRangePickerModule
    ],


standalone: true,
    selector: 'app-root',
    template: `
        <ejs-daterangepicker #ejDateRangePicker placeholder='Select a range'></ejs-daterangepicker>
        `
})

export class AppComponent {
   @ViewChild('ejDateRangePicker') ejDateRangePicker?: CalendarComponent;
   @HostListener('document:keyup', ['$event'])
  handleKeyboardEvent(event: KeyboardEvent) {
    if (event.altKey && event.keyCode === 84 /* t */) {
        // press alt+t to focus the control.
        (this.ejDateRangePicker as any).inputElement.focus();
    }
  }
    constructor() {
    }
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));

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.

See also