Skip to main content

<dialog> showModal() / close()

The dialog element and its methods for opening it as a modal and closing it with a return value. Specification: html.spec.whatwg.org/multipage/interactive-elements.html.

Results​

Probed on 2026-10-19 with Node.js v22.23.3.

warpdom 0.1.6​

Missing

Missing: in this engine's window, this does not hold: HTMLDialogElement exists and a <dialog> has showModal().

Web IDL existence (coverage):

  • HTMLDialogElement: interface present; 1 of 7 members present, missing: returnValue, closedBy, show, showModal, close, requestClose.
Report a wrong result for warpdom

happy-dom 21.0.3​

Partial

2 of 3 checks work.

Web IDL existence (coverage):

  • HTMLDialogElement: interface present; 5 of 7 members present, missing: closedBy, requestClose.

  • showModal() on a dialog that is not in a document throws an "InvalidStateError" DOMException.

    • Result: showModal() on a disconnected dialog: expected InvalidStateError, nothing was thrown
Report a wrong result for happy-dom

jsdom 30.1.3​

Missing

Missing: in this engine's window, this does not hold: HTMLDialogElement exists and a <dialog> has showModal().

Web IDL existence (coverage):

  • HTMLDialogElement: interface present; 1 of 7 members present, missing: returnValue, closedBy, show, showModal, close, requestClose.
Report a wrong result for jsdom

linkedom 0.18.13​

Missing

Missing: in this engine's window, this does not hold: HTMLDialogElement exists and a <dialog> has showModal().

Web IDL existence (coverage):

Report a wrong result for linkedom

Checks​

Exists when: HTMLDialogElement exists and a <dialog> has showModal().

  • show-modal-opens: showModal() on a connected dialog sets .open to true and adds the open attribute. (spec)
  • close-return-value: close("done") clears open, sets returnValue to "done" and fires a "close" event. (spec)
  • disconnected-throws: showModal() on a dialog that is not in a document throws an "InvalidStateError" DOMException. (spec)