Skip to content

Commit 16d08f9

Browse files
committed
fix: allow "role=alertdialog" to be closed on escape
This assumption was based on the description of https://github.com/edenspiekermann/a11y-dialog#usage-as-a-modal. But reading the spec, I don't find a reference to prevent alertdialog dismiss with the `Esc` key. Actually the aria example is dismissable by escape key https://www.w3.org/TR/wai-aria-practices-1.1/examples/dialog-modal/alertdialog.html That being said, the backdrop click is still prevented with the role "alertdialog" because the spec also says that "keyboard and mouse interactions only operate within the dialog." and currently our backdrop is outside the dialgoRoot element (although) it's not invalid to move it inside (never tested it) - so this requires further thought
1 parent 7719aac commit 16d08f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/A11yVueDialogRenderless.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
},
4141
/**
4242
* @desc accessibilty attribute: possible usage as modal. If "alertdialog"
43-
* will not close on "Escape" key or backdrop click.
43+
* will not close on backdrop click.
4444
* @see https://github.com/edenspiekermann/a11y-dialog#usage-as-a-modal
4545
*/
4646
role: {
@@ -128,7 +128,7 @@ export default {
128128
129129
const { key, target } = e;
130130
131-
if (key === 'Escape' && this.role !== 'alertdialog') {
131+
if (key === 'Escape') {
132132
// do not interfere with native input behaviour
133133
if (target.type === 'search' && target.value !== '') return
134134

0 commit comments

Comments
 (0)