Accessibility in Blazor Dialog Component
29 Nov 20246 minutes to read
The Blazor Dialog is characterized with complete ARIA Accessibility support which makes it accessible to on-screen readers and other assistive technology devices. This component is designed with the reference of the guidelines document given in WAI ARAI Accessibility Practices.
The Blazor Dialog 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 Dialog 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 Dialog component uses the Dialog
role and following ARIA properties to its element based on its state.
Property | Functionalities |
---|---|
aria-describedby | Indicates that the Dialog content description is notified to the users through assistive technologies. |
aria-labelledby | The Dialog title is notified to the users through assistive technologies. |
aria-modal | For modal dialog, it’s value is true and non-modal dialog its value is false |
aria-grabbed | Enables the draggable Dialog and starts dragging if its value is true and stops dragging if its value is false. |
Keyboard interaction
Keyboard interaction of Blazor Dialog component has been designed based on WAI-ARIA Practices described for Dialog. User 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, when pressing the Enter key, the click event associated with the primary button or button will trigger. Enter key does not work when the Dialog content contains any text area with initial focus |
Ctrl + Enter | When the Dialog content contains text area and it is in focus state, press the Ctrl + Enter key to call the click event function associated with primary button |
Tab | Focus will be changed within the Dialog elements |
Shift + Tab | The Focus will be changed previous focusable element within the Dialog elements. When focusing a first focusable element in the Dialog, then press the shift + tab key, it will change the focus to last focusable element |
@using Syncfusion.Blazor.Popups
@using Syncfusion.Blazor.Buttons
<SfButton @onclick="@OpenDialog">Open Dialog</SfButton>
<SfDialog Width="400px" Height="358px" ShowCloseIcon="true" @bind-Visible="@IsVisible">
<DialogTemplates>
<Header>
<div>Feedback</div>
</Header>
<Content>
<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='4' id='comment'></textarea>
</div>
</form>
</Content>
</DialogTemplates>
<DialogButtons>
<DialogButton Content="Submit" IsPrimary="true" OnClick="@CloseDialog" />
</DialogButtons>
</SfDialog>
@code {
private bool IsVisible { get; set; } = true;
private void OpenDialog()
{
this.IsVisible = true;
}
private void CloseDialog()
{
this.IsVisible = false;
}
}
See also
Ensuring accessibility
The Blazor Dialog component’s accessibility levels are ensured through an axe-core software tool 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.