<dialog> Modal
HC · Semantic Elementssyntax
<dialog id="myDialog">
Content
<button>Close</button>
</dialog>example
<dialog id="confirmDialog">
<h2>Confirm Deletion</h2>
<p>This will permanently remove the item. Continue?</p>
<form method="dialog">
<button value="cancel">Cancel</button>
<button value="confirm">Delete</button>
</form>
</dialog>
<!-- Open with: document.getElementById('confirmDialog').showModal() -->Note Use showModal() to open with a backdrop that traps focus (accessible). Use show() for a non-modal popup. The form method="dialog" approach closes the dialog and sets its returnValue to the button's value.