aria.Dialog(dialogId, focusAfterClosed, focusFirst)

new Dialog(dialogId, focusAfterClosed, focusFirst)

Dialog object providing modal focus management. Assumptions: The element serving as the dialog container is present in the DOM and hidden. The dialog container has role='dialog'.
Parameters:
Name Type Description
dialogId The ID of the element serving as the dialog container.
focusAfterClosed Either the DOM node or the ID of the DOM node to focus when the dialog closes.
focusFirst Optional parameter containing either the DOM node or the ID of the DOM node to focus when the dialog opens. If not specified, the first focusable element in the dialog will receive focus.

Methods

close()

Hides the current top dialog, removes listeners of the top dialog, restore listeners of a parent dialog if one was open under the one that just closed, and sets focus on the element specified for focusAfterClosed.

replace(newDialogId, newFocusAfterClosed, newFocusFirst)

Hides the current dialog and replaces it with another.
Parameters:
Name Type Description
newDialogId ID of the dialog that will replace the currently open top dialog.
newFocusAfterClosed Optional ID or DOM node specifying where to place focus when the new dialog closes. If not specified, focus will be placed on the element specified by the dialog being replaced.
newFocusFirst Optional ID or DOM node specifying where to place focus in the new dialog when it opens. If not specified, the first focusable element will receive focus.