DOM Interfaces
HTMLDialogElement
Represents a native dialog with modal and non-modal opening methods, close requests and return values. Setting open manually is not equivalent to showModal(); only modal opening establishes the browser's modal interaction behavior. Example result: false.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLDialogElementReturn Value
HTMLDialogElement
An existing HTML DOM object associated with the dialog element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
<dialog id="demo" aria-label="Notice">Notice</dialog><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.open);</script>Browser Compatibility
Minimum supported versions across modern rendering engines
Widely Available (2022)
Blink
Chrome
37+
Yes
Gecko
Firefox
98+
Yes
WebKit
Safari
15.4+
Yes
Basic feature support; newer dialog members have their own compatibility.
HTML Living Standard