Accessibility in Blazor ComboBox Component

4 Nov 20258 minutes to read

The Blazor ComboBox component has been designed with the WAI-ARIA specifications in mind, and applies the WAI-ARIA roles, states, and properties along with keyboard support. This component is characterized
by complete keyboard interaction support and ARIA accessibility support that makes it easy for people who use assistive technologies (AT) or those who completely rely on keyboard navigation.

The Blazor ComboBox component follows accessibility guidelines and standards, including ADA, Section 508, and WCAG 2.2, and it implements appropriate WCAG roles commonly used to evaluate accessibility.

The accessibility compliance for the Blazor ComboBox component is outlined below.

Accessibility Criteria Compatibility
WCAG 2.2 Support Meets requirement
Section 508 Support Meets requirement
Screen Reader Support Meets requirement
Right-to-left support Meets requirement
Color Contrast Meets requirement
Mobile Device Support Meets requirement
Keyboard Navigation Support Meets requirement
Axe-core Accessibility Validation Meets requirement
Meets requirement - All features of the component meet the requirement.
Partially meets requirement - Some features of the component do not meet the requirement.
Does not meet requirement - The component does not meet the requirement.

WAI-ARIA attributes

The Blazor ComboBox component uses the combobox role, and each list item has an option role. The following ARIA attributes denotes the ComboBox state:

Properties Functionalities
aria-haspopup Indicates that the ComboBox input has a popup (listbox).
aria-expanded Indicates the expanded or collapsed state of the popup list.
aria-selected Indicates the selected option.
aria-readonly Indicates that the ComboBox is read-only.
aria-disabled Indicates that the ComboBox is disabled.
aria-activedescendant References the ID of the active option in the listbox to indicate focus for assistive technologies.
aria-owns References the ID of the popup list to associate it as a controlled element.
aria-autocomplete Indicates the autocomplete behavior (for example, list or both) depending on whether the list and inline suggestion are shown.

Keyboard interaction

Use the following key shortcuts to access and operate the Blazor ComboBox:

Windows Mac Actions
Focus    
Alt + J + J Focuses the first component in the sample (sample-specific shortcut for demonstration).
Input Navigation    
Alt + + Opens the popup list.
Alt + + Closes the popup list.
Home Home Moves the cursor to the beginning of the input.
End End Moves the cursor to the end of the input.
Tab Tab Focuses on the next TabIndex element on the page when the popup is closed. Otherwise, closes the popup list and remains the focus of the component.
Shift + Tab + Tab Focuses on the previous TabIndex element on the page when the popup is closed. Otherwise, closes the popup list and remains the focus of the component.
Selection    
Enter Enter Selects the focused item. If open, the popup closes; otherwise, toggles the popup.
Popup Navigation    
Esc Escape Closes the popup when open and keeps the current selection.
Selects the first item when none is selected; otherwise, moves to the next item.
Moves to the previous item.
Page Down Page Down Scrolls down one page in the list and selects the first visible item.
Page Up Page Up Scrolls up one page in the list and selects the first visible item.

NOTE

In the following sample, pressing the t key disables the ComboBox for demonstration purposes.

@using Syncfusion.Blazor.DropDowns

<SfComboBox TValue="string" TItem="Country" @ref="ComboObj" Enabled="@enable" Placeholder="Select a country" @onkeypress="@(e => KeyPressed(e))" DataSource="@LocalData">
    <ComboBoxFieldSettings Value="Code" Text="Name"></ComboBoxFieldSettings>
</SfComboBox>

@code {

    public SfComboBox<string, Country> ComboObj;

    public bool enable { get; set; } = true;
    public class Country
    {
        public string Name { get; set; }
        public string Code { get; set; }
    }

    List<Country> LocalData = new List<Country> {
        new Country() { Name = "Australia", Code = "AU" },
        new Country() { Name = "Bermuda", Code = "BM" },
        new Country() { Name = "Canada", Code = "CA" },
        new Country() { Name = "Cameroon", Code = "CM" },
        new Country() { Name = "Denmark", Code = "DK" },
        new Country() { Name = "France", Code = "FR" },
        new Country() { Name = "Finland", Code = "FI" },
        new Country() { Name = "Germany", Code = "DE" },
        new Country() { Name = "Greenland", Code = "GL" },
        new Country() { Name = "Hong Kong", Code = "HK" },
    };

    public void KeyPressed(KeyboardEventArgs args)
    {
        if (args.Key == "t")
        {
            enable = false;
        }
    }
}

Ensuring accessibility

The Blazor ComboBox component’s accessibility levels are validated using axe-core during automated testing.

The accessibility compliance of the ComboBox component is demonstrated in the following sample. Open the ComboBox accessibility sample in a new window to evaluate the component with accessibility tools.

See also