Read This First
No ARIA is better than Bad ARIA. Before using any ARIA, read this to understand why.
How to build accessibility semantics into web patterns and widgets
No ARIA is better than Bad ARIA. Before using any ARIA, read this to understand why.
A dialog is a window overlaid on either the primary window or another dialog window. Windows under a modal dialog are inert. That is, users cannot interact with content outside an active dialog window. Inert content outside an active dialog is typically visually obscured or dimmed so it is difficult to discern, and in some implementations, attempts to interact with the inert content cause the dialog to close.
Like non-modal dialogs, modal dialogs contain their tab sequence. That is, Tab and Shift + Tab do not move focus outside the dialog. However, unlike most non-modal dialogs, modal dialogs do not provide means for moving keyboard focus outside the dialog window without closing the dialog.
The alertdialog role is a special-case dialog role designed specifically for dialogs that divert users' attention to a brief, important message. Its usage is described in the Alert Dialog Pattern.
In the following description, the term tabbable element
refers to any element with a tabindex
value of zero or greater.
Note that values greater than 0 are strongly discouraged.
tabindex="-1"
to a static element at the start of the content and initially focus that element.
This makes it easier for assistive technology users to read the content by navigating the semantic structures.
Additionally, it is advisable to omit applying aria-describedby
to the dialog container in this scenario.
tabindex="-1"
to a static element at the top of the dialog, such as the dialog title or first paragraph, and initially focus that element.OKor
Continuebutton.
button
that closes the dialog, such as a close icon or cancel button.dialog
.true
.dialog
role to indicate which element or elements in the dialog contain content that describes the primary purpose or message of the dialog.
Specifying descriptive elements enables screen readers to announce the description along with the dialog title and initially focused element when the dialog opens, which is typically helpful only when the descriptive content is simple and can easily be understood without structural information.
It is advisable to omit specifying aria-describedby
if the dialog content includes semantic structures, such as lists, tables, or multiple paragraphs, that need to be perceived in order to easily understand the content, i.e., if the content would be difficult to understand when announced as a single unbroken string.
true
can prevent users of some assistive technologies from perceiving content outside the dialog, users of those technologies will experience severe negative ramifications if a dialog is marked modal but does not behave as a modal for other users.
So, mark a dialog modal only when both:
aria-modal
property introduced by ARIA 1.1 replaces aria-hidden for informing assistive technologies that content outside a dialog is inert.
However, in legacy dialog implementations where aria-hidden
is used to make content outside a dialog inert for assistive technology users, it is important that:
aria-hidden
is set to true
on each element containing a portion of the inert layer.aria-hidden
set to true
.This is an unpublished draft preview that might include content that is not yet approved. The published website is at w3.org/WAI/.