Accessibility in ASP.NET CORE Dialog

27 Aug 20267 minutes to read

The Dialog 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 Dialog component is outlined below.

Accessibility Criteria Compatibility
WCAG 2.2 Support AA
Section 508 Support Yes
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 Dialog is characterized by complete ARIA accessibility support, which helps on-screen readers and other assistive technologies access the component. This component is designed with the reference of the guidelines document given in WAI ARIA Accessibility Practices.

The Dialog control uses the dialog role and the following ARIA properties on its element based on its state.

Property Functionalities
aria-describedby It indicates the Dialog content description that is notified to the user through assistive technologies.
aria-labelledby The Dialog title is notified to the user through assistive technologies.
aria-modal For a modal dialog its value is true and for a non-modal dialog its value is false.
aria-grabbed When the draggable Dialog is enabled, the value is true while dragging and false when the drag stops. (Deprecated in ARIA 1.1.)

Keyboard interaction

Keyboard interaction of the Dialog control has been designed based on WAI-ARIA Practices described for Dialog. Users can use the following shortcut keys to interact with the Dialog.

Keyboard shortcuts Actions
Esc Closes the Dialog. This functionality can be controlled by using `closeOnEscape`
Enter When the Dialog button or any input (except text area) is in focus state, pressing the Enter key triggers the click event of the focused button (or the primary button). The Enter key does not trigger the button click when a text area inside the Dialog has initial focus.
Ctrl + Enter When the Dialog content contains a text area and it is in focus state, press the Ctrl + Enter key to call the click event function associated with the primary button.
Tab Focus will be changed within the Dialog elements.
Shift + Tab The focus will move to the previous focusable element within the Dialog elements. When focusing the first focusable element in the Dialog, pressing the Shift + Tab key will change the focus to the last focusable element.
<div id='container' style="height:400px;">
        <ejs-button id="targetButton" content="Open Dialog"></ejs-button>
        <ejs-dialog id="dialog" header="Feedback" showCloseIcon="true" target="#container" width="400px" height="300px">
            <e-content-template>
                <form>
                    <div class='form-group'>
                        <label for='email'>Email:</label><input type='email' class='form-control' id='email'>
                    </div><div class='form-group'>
                    </div><div class='form-group'>
                        <label for='comment'>Comments:</label><textarea style='resize: none;' class='form-control' rows='5' id='comment'></textarea>
                    </div>
                </form>
            </e-content-template>
            <e-dialog-buttons>
                <e-dialog-dialogbutton buttonModel="@ViewBag.DialogButtons" click="dlgButtonClick"></e-dialog-dialogbutton>
            </e-dialog-buttons>
        </ejs-dialog>
    </div>
<script>
    window.onload = function () {
        document.getElementById('targetButton').onclick = function () {
            var dialog = document.getElementById("dialog").ej2_instances[0];
            dialog.show();
        }
    }
    function dlgButtonClick() {
        var dialogObj = document.getElementById('dialog').ej2_instances[0];
        dialogObj.hide();
    }
</script>
public class HomeController : Controller
{
    public class ButtonModel
    {
        public string content { get; set; }
        public string cssClass { get; set; }
    }

    public ActionResult Index()
    {
        ViewBag.DialogButtons = new ButtonModel() { cssClass = "e-flat", content = "Submit" };
        return View();
    }
}

Ensuring accessibility

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

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

See also