<dialog> The Velvet Rope
a modal that checks tickets
● alive
ACCESSION TPL-037 · HTML Living Standard · collected 2013, tamed 2022
A real modal — focus trapped, page behind it inert, ::backdrop dimming the
whole gallery. Opened by an invoker button, closed by a plain
<form method="dialog">, the Esc key, or the dimmed floor itself
where closedby has landed.
- invoke “Sound the rope” — watch the room dim
- press Esc, or click the darkness outside
- the pinned specimen stays on display even where invokers haven’t shipped
Field reports Baseline · widely available
Chrome 37+Edge 79+ Firefox 98+Safari 15.4+
caniuse: dialog →The markup itself a <details>
<button command="show-modal" commandfor="rope">…</button>
<dialog id="rope" closedby="any">
<form method="dialog">
<button>Admire & close</button>
</form>
</dialog>
The button carries no wires. commandfor points at the dialog by id — the browser does the rest.