Retweeted
You can use method=”dialog” for a form in a dialog to close the dialog on submit.
<dialog open>
<p>Never show dialogs on page load!</p>
<form method=”dialog”>
<button>Close dialog</button>
</form>
</dialog>