Edit in GitHubLog an issue

Showing a Modal Dialog

Dialogs are shown using the HTMLDialogElement#showModal method. This method will render the dialog. The method will return a Promise, which you can use to easily wait for the dialog to be dismissed.

Copied to your clipboard
1dialog.showModal().then((result) => {
2 // handle dialog result
3 // if canceled by ESC, will be "reasonCanceled"
4});

Info

The dialog element must be present in the DOM before showing it. If it isn't, the method will throw an exception.

It's important to note that you can only show one dialog at once. You should always close or dismiss a dialog first and then wait for the dialog's promise to resolve before showing another one.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.