Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's no event for the dialog about to close, only an event for after the dialog closes. You can prevent default on the enter key and space key, but that obviously breaks the form ux.

There is an event for the dialog about to close from pressing the escape key. No idea why it's only for closing via escape key.



I think they meant prevent the form submission on the `submit` event and use JavaScript to make the submission.

https://developer.mozilla.org/en-US/docs/Learn/Forms/Sending...




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: