Accessibility in Vue Timepicker component
11 Jun 20247 minutes to read
The TimePicker 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 TimePicker component is outlined below.
WAI-ARIA attributes
The web accessibility makes web applications and its content more accessible to people with disabilities without any barriers. It especially it tracks the dynamic value changes and DOM changes.
The TimePicker component has covered the WAI-ARIA specifications with the following list of WAI-ARIA
attributes: aria-haspopup
, aria-selected
, aria-disabled
, aria-activedescendant
, aria-expanded
, aria-owns
, and aria-autocomplete
.
Here in TimePicker, the combobox
plays the role of input element, and the listbox
plays the role of popup element.
-
Aria-haspopup: Provides the information about whether this element display a pop-up window or not.
-
Aria-selected: Indicates the current selected value of the TimePicker component.
-
Aria-disabled: Indicates disabled state of the TimePicker component.
-
Aria-expanded: Indicates the expanded state of the popup.
-
Aria-autocomplete: Indicates whether user input completion suggestions are provided or not.
-
Aria-owns: Attribute that creates a parent/child relationship between two DOM element in the accessibility layer.
-
Aria-activedescendent: Attribute that helps in managing the current active child of the TimePicker component.
-
Role: Attribute that gives assistive technology information for handling each element in a widget.
Keyboard Interaction
Keyboard accessibility is one of the most important aspects of web accessibility. Disabled people like blind and those who have motor disabilities or birth defects use keyboard shortcuts more than the mouse.
The TimePicker component has built-in keyboard accessibility support by following the WAI-ARIA practices.
It supports the following list of shortcut keys to interact with the TimePicker control.
Press | To do this |
---|---|
Upper Arrow | Navigate and select the previous item. |
Down Arrow | Navigate and select the next item. |
Left Arrow | Move the cursor towards arrow key pressed direction. |
Right Arrow | Move the cursor towards arrow key pressed direction. |
Home | Navigate and select the first item. |
End | Navigate and select the last item. |
Enter | Select the currently focused item and close the popup. |
Alt + Upper Arrow | Close the popup. |
Alt + Down Arrow | Open the popup. |
Esc | Close the popup. |
In the below sample use the alt+t
keys to focus the TimePicker component.
<template>
<div id="app">
<div class='wrap'>
<ejs-timepicker id='timepicker' ref="time"></ejs-timepicker>
</div>
</div>
</template>
<script setup>
import { TimePickerComponent as EjsTimepicker } from "@syncfusion/ej2-vue-calendars";
import { onMounted, ref } from 'vue';
const time = ref(null);
onMounted(() => {
let TimeObj = time.value;
document.onkeyup = function (e) {
if (e.altKey && e.keyCode === 84) {
// press alt+t to focus the control.
TimeObj.$el.focus();
}
}
});
</script>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import '../node_modules/@syncfusion/ej2-lists/styles/material.css';
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
.wrap {
margin: 35px auto;
width: 240px;
}
</style>
<template>
<div id="app">
<div class='wrap'>
<ejs-timepicker id='timepicker' ref="time"></ejs-timepicker>
</div>
</div>
</template>
<script>
import { TimePickerComponent } from "@syncfusion/ej2-vue-calendars";
export default {
name: "App",
components: {
"ejs-timepicker": TimePickerComponent
},
mounted() {
let TimeObj = this.$refs.time;
document.onkeyup = function (e) {
if (e.altKey && e.keyCode === 84) {
// press alt+t to focus the control.
TimeObj.$el.focus();
}
}
}
}
</script>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import '../node_modules/@syncfusion/ej2-lists/styles/material.css';
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
.wrap {
margin: 35px auto;
width: 240px;
}
</style>
Ensuring accessibility
The TimePicker component’s accessibility levels are ensured through an accessibility-checker and axe-core software tools during automated testing.
The accessibility compliance of the TimePicker component is shown in the following sample. Open the sample in a new window to evaluate the accessibility of the TimePicker component with accessibility tools.