Accessibility in ASP.NET CORE DropDownList
24 Aug 20267 minutes to read
The DropDownList control is designed to follow the WAI-ARIA specifications, applying WAI-ARIA roles, states, and properties, with full keyboard support. The control provides full keyboard interaction and ARIA accessibility support, making it easy for users of assistive technologies (AT) or keyboard-only navigation.
The DropDownList component 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 DropDownList component is outlined below.
| Accessibility Criteria | Compatibility |
|---|---|
| WCAG 2.2 Support | AA |
| Section 508 Support | ![]() |
| Screen Reader Support | ![]() |
| Right-To-Left Support | ![]() |
| Color Contrast | ![]() |
| Mobile Device Support | ![]() |
| Keyboard Navigation Support | ![]() |
| Accessibility Checker Validation | ![]() |
- All features of the component meet the requirement.
- Some features of the component do not meet the requirement.
- The component does not meet the requirement.WAI-ARIA attributes
The DropDownList control uses the Listbox role, and each list item has an option role. The following ARIA attributes denote the DropDownList state.
| Properties | Functionalities |
|---|---|
| aria-haspopup | Indicates whether the DropDownList input element has a popup list or not. |
| aria-expanded | Indicates whether the popup list has expanded or not. |
| aria-selected | Indicates the selected option. |
| aria-readonly | Indicates the readonly state of the DropDownList element. |
| aria-disabled | Indicates whether the DropDownList control is in a disabled state or not. |
| aria-activedescendant | Holds the ID of the active list item used to set focus on the corresponding descendant element. |
| aria-owns | This attribute contains the ID of the popup list to indicate popup as a child element. |
Keyboard interaction
You can use the following key shortcuts to access the DropDownList without interruptions.
| Keyboard shortcuts | Actions |
|---|---|
| Arrow Down | Selects the first item in the DropDownList when no item is selected. Otherwise, selects the item next to the currently selected item. |
| Arrow Up | Selects the item previous to the currently selected one. |
| Page Down | Scrolls down to the next page and selects the first item when popup list opens. |
| Page Up | Scrolls up to the previous page and selects the first item when popup list opens. |
| Enter | Selects the focused item, and when it is in an open state the popup list closes. Otherwise, toggles the popup list. |
| Tab | Focuses on the next TabIndex element on the page when the popup is closed. Otherwise, closes the popup list and retains the focus of the control. |
| Shift + tab | Focuses on the previous TabIndex element on the page when the popup is closed. Otherwise, closes the popup list and retains the focus of the control. |
| Alt + Down | Opens the popup list. |
| Alt + Up | Closes the popup list. |
| Esc(Escape) | Closes the popup list when open; the current selection is preserved. |
| Home | Selects the first item. |
| End | Selects the last item. |
In the following sample, focus the DropDownList control using the alt+t key combination.
<div class="control-wrapper">
<div id="default" style='padding-top:75px;margin:0 auto;width:250px;'>
<ejs-dropdownlist id="games" dataSource="@ViewBag.data" placeholder="Select a game" popupHeight="220px">
</ejs-dropdownlist>
</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>using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WebApplication1.Models;
namespace WebApplication1.Controllers
{
public class DropDownListController : Controller
{
public ActionResult accessibility()
{
ViewBag.data = new string[] { "Badminton", "Basketball", "Cricket", "Football", "Golf", "Gymnastics", "Hockey", "Tennis" };
return View();
}
}
}Ensuring accessibility
The DropDownList component’s accessibility levels are ensured through an accessibility-checker and axe-core software tools during automated testing.
The accessibility compliance of the DropDownList component is shown in the following sample. Open the sample in a new window to evaluate the accessibility of the DropDownList component with accessibility tools.