Accessibility in ASP.NET CORE AutoComplete

27 Aug 20267 minutes to read

The AutoComplete control has been designed, keeping in mind the WAI-ARIA specifications, and applies the WAI-ARIA roles, states, and properties along with keyboard support. This control 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 AutoComplete control follows 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 AutoComplete control is outlined below.

Accessibility Criteria Compatibility
WCAG 2.2 Support AA
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
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 AutoComplete control uses the combobox role and each list item has an option role. The following ARIA attributes denote the AutoComplete state.

Property Functionalities
aria-haspopup Indicates whether the AutoComplete input element has a suggestion list or not.
aria-expanded Indicates whether the suggestion list has expanded or not.
aria-selected Indicates the selected option from the list.
aria-readonly Indicates the readonly state of the AutoComplete element.
aria-disabled Indicates whether the AutoComplete control is in a disabled state or not.
aria-activedescendant This attribute holds the ID of the active list item to focus its descendant child element.
aria-owns This attribute contains the ID of the suggestion list to indicate popup as a child element.
aria-autocomplete This attribute contains the ‘both’ to a list of options shows and the currently selected suggestion also shows inline.

Keyboard interaction

You can use the following key shortcuts to access the AutoComplete without interruptions.

Keyboard shortcuts Actions
Arrow Down In popup hidden state, opens the suggestion list. In popup open state, focus the first item when no item is selected, else focus the item next to the currently selected item.
Arrow Up In popup hidden state, opens the suggestion list. In popup open state, focus the last item when no item is selected, else focus the item previous to the currently selected one.
Page Down Scrolls down to the next page and focuses the first item when popup list opens.
Page Up Scrolls up to previous page and focuses the first item when popup list opens.
Enter Selects the focused item and set to AutoComplete control.
Tab Focuses on the next tab indexed element when the popup is closed. Otherwise, closes the popup list and remains focus in the control if the popup is open.
Shift + Tab Focuses the previous tab indexed element when the popup is closed. Otherwise, closes the popup list and remains focus in the control if the popup is open.
Alt + Down Opens the popup list.
Alt + Up In popup hidden state, opens the popup list. In popup open state, closes the popup list.
Esc (Escape) Closes the popup list when it is in an open state then removes the selection.
Home Cursor moves to before the first character in the input.
End Cursor moves to after the last character in the input.

In the following sample, focus the AutoComplete control using alt+t keys.

@{
	var data = new string[] { "Badminton", "Basketball", "Cricket", "Football", "Golf", "Gymnastics", "Hockey", "Tennis" };
}
<div class="control-wrapper">
    <div id="default" style='padding-top:75px;margin:0 auto;width:250px;'>
        <ejs-autocomplete id="games" dataSource="@data" placeholder="Select a game" popupHeight="220px">
        </ejs-autocomplete>
    </div>
</div>
<script>
    document.onkeyup = function (e) {
        var atcObject = document.getElementById("games").ej2_instances[0];
        if (e.altKey && e.keyCode === 84 /* t */) {
            // press alt+t to focus the control.
            atcObject.focusIn();
        }
    };
</script>

View Sample in GitHub.

Ensuring accessibility

The AutoComplete control’s accessibility levels are ensured through an accessibility-checker and axe-core software tools during automated testing.

The accessibility compliance of the AutoComplete control is shown in the following sample. Open the sample in a new window to evaluate the accessibility of the AutoComplete control with accessibility tools.

See also