Closed runarberg closed 4 years ago
<dialog> <form id="my-dialog-form" method="dialog"> <button value="close">Close</button> </form> </dialog>
const dialogForm = document.getElementById('my-dialog-form'); dialogForm.addEventListener('submit', event => event.preventDefault());
The dialog should not close. That is, the submit event should not trigger the close event for the <dialog>.
submit
close
<dialog>
The dialog closes. Note this does not happen if you add this listener in browsers that support native dialogs.
How to reproduce
Expected behavior
The dialog should not close. That is, the
submit
event should not trigger theclose
event for the<dialog>
.Actual behavior
The dialog closes. Note this does not happen if you add this listener in browsers that support native dialogs.