Accessibility in Blazor Carousel Component
13 Dec 20245 minutes to read
The Blazor Carousel component has been designed, keeping in mind the WAI-ARIA specifications, and applying the WAI-ARIA roles, states and properties along with keyboard support. Thus, making it usable for people who use assistive WAI-ARIA accessibility supports that is achieved through attributes like aria-label
, aria-current
, aria-live
, aria-role
and aria-hidden
. It helps to provides information about the elements in a document for assistive technology. The component implements the keyboard navigation support by following the WAI-ARIA practices and tested in major screen readers.
The Blazor Carousel 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 Carousel 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
The Blazor carousel component is designed by considering WAI-ARIA standard. Carousel is supported with ARIA Accessibility which is accessible by on-screen readers and other assistive technology devices. The following list of attributes is added to the Carousel.
Attributes | Purpose |
---|---|
aria-roledescription |
The role description attribute should be added for the root element (carousel) and each carousel slide item (slide). |
aria-label |
Previous, next and play/pause buttons and all indicator elements. |
aria-current |
For the active item indicator element, aria-current is set to true . |
aria-hidden |
For all carousel elements except the currently visible item, aria-hidden is set to true . |
aria-live |
For carousel items element, when autoPlay is true , aria-live is set to off ; when autoPlay is false , aria-live is set to polite . |
aria-role |
For carousel slide item, aria-role should be group. |
Keyboard interaction
All Carousel actions can be controlled using keyboard keys through the allowKeyboardInteraction
property, which is enabled by default. If you wish to disable the default keyboard interactions, you can set this property to false
. This is particularly useful if the carousel contains input elements, as pressing the arrow keys might cause the carousel to move unexpectedly. By disabling keyboard interaction, the carousel remains static, allowing the user to focus on the input fields without any interruptions.
This control implements keyboard navigation support by following WAI-ARIA practices. Once focused on the active Carousel element, you can use the following key combinations to interact with the Carousel.
Key | Description |
---|---|
Alt + J | Keys to focus the carousel component (done at application end). |
Arrows | Keys to navigate between slides. |
Home | To navigate to the first slide. |
End | To navigate to the last slide. |
Space | To play/pause the slide transitions. |
Enter | To perform the respective action on its focus. |
Ensuring accessibility
The Blazor Carousel component’s accessibility levels are ensured through an axe-core software tool during automated testing.
The accessibility compliance of the Carousel component is shown in the following sample. Open the sample in a new window to evaluate the accessibility of the Carousel component with accessibility tools.