Skip to content

Commit

Permalink
add alertdialog to the list of valid Dialog roles
Browse files Browse the repository at this point in the history
  • Loading branch information
sh0ji committed May 22, 2018
1 parent c585cca commit 6de2fd0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/dialog-modal/js/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ aria.Utils = aria.Utils || {};
*/
aria.Dialog = function (dialogId, focusAfterClosed, focusFirst) {
this.dialogNode = document.getElementById(dialogId);
var role = this.dialogNode.getAttribute('role');

if (this.dialogNode === null ||
this.dialogNode.getAttribute('role') !== 'dialog') {
if (this.dialogNode === null || !['dialog', 'alertdialog'].includes(role)) {
throw new Error(
'Dialog() requires a DOM element with ARIA role of dialog.');
'Dialog() requires a DOM element with ARIA role of dialog or alertdialog.');
}

// Wrap in an individual backdrop element if one doesn't exist
Expand Down

0 comments on commit 6de2fd0

Please sign in to comment.