Go to overview: WAI-ARIA techniques with code examples
role=dialog
to expose a dialog (pop-up div box)Detlev Fischer, (detlev [dot] fischer [ at ] testkreis [dot] de)
Twitter: @wcagtest
Last update: 18 March 2013
Note: There is now a modified version of this dialog based on input by @cookiecrook, to improve accessibility in iOS which attains accessibility in JAWS + Firefox and improves mobile accessibility somewhat.
This example shows how to use the Aria role dialog
when opening pseudo window (div boxes) dialogues via scripting. The div
with role=dialog
references the h3
heading inside the dialog box via the aria-labelledby
attribute, as recommended by @gezlemon in his article Custom-Built Dialogs. For simplicty, the dialogue div
is originally just hidden, not dynamically inserted on the page via DOM scripting (I hope this doesn't make a difference in terms of focus handling, but it may).
The example utilises the focus management scripts from Making an accessible dialog box by Nicholas C. Zakas. (Note that the latter author recommends using aria-describedby
to reference the heading inside the dialogue).
Note: according to @jage9, role=dialog
also works in Window-Eyes 8.
dialog
to announce a dialog (pop-up div box)The sequence runs from focusing the trigger link to refocusing the same link after closing the dialogue. Tabbing action is indicated with TAB, enter with ENTER (Mac OS X: RETURN), arrowing down with DOWN ARROW, swiping with RIGHT SWIPE, double tapping with DOUBLE TAP.
Win 7, IE 9, JAWS 14 | Supported |
|
---|---|---|
Win 7, FF 18, JAWS 14 | Not supported |
|
Win 7, IE9, NVDA 2012.2.1 | Supported (but repetitive) |
|
Win 7, FF 18, NVDA 2012.2.1 | Supported |
|
Mac OS 10.8.x, Safari, VoiceOver (Test supplied by @cookiecrook) |
Supported |
|
Mac OS 10.6.8, Safari, VoiceOver | Supported (but repetitive) |
(Please note that later versions of VoiceOver will have better support and may produce different output.)
|
iOS 6.1,Safari, VoiceOver (iPad mini) | Not supported | VoiceOver does not read role dialog . Script to move focus to dialog does not work; after activating the link (double-tab), the announcement of "display.." seems to be interrupted by the fous move to the first focusable item on the page ("Go to overview"). Accessing the dialogue would then need to move the oage again before reaching it. Script to contain focus in dialog does not work.RIGHT SWIPE Display a dialog - hyperlink DOUBLE TAP display - go to overview |
Android 4.2, Firefox, Talkback (Nexus 7) | Partial support | While aria role
Note that while the script correctly moves the focus back to the triggering link, script does not keep the focus inside the dialogue; swiping moves beyond the dialog's focusable items. |