Cannot prevent cancel when user presses Escape twice
- Dominant language
- Markdown
- Stars
- 11k
- Forks
- 23.2k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 331
Description
### MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event
### What specific section or headline is this issue about?
_No response_
### What information was incorrect, unhelpful, or incomplete?
"You can uncomment the line containing event.preventDefault() to cancel the event."
### What did you expect to see?
... except if user presses Escape twice. In that case the second preventDefault() is ignored, and the dialog will close. (At least for Firefox and Chrome on Windows)
### Do you have any supporting links, references, or citations?
_No response_
### Do you have anything more you want to share?
_No response_
### MDN metadata
Page report details
* Folder: `en-us/web/api/htmldialogelement/cancel_event`
* MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event
* GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/htmldialogelement/cancel_event/index.md
* Last commit: https://github.com/mdn/content/commit/661a04e7a61abe3d8c7245f04cdd1d0bc865fe69
* Document last modified: 2026-01-26T06:55:57.000Z
Contributor guide
Assessment
This issue has not been assessed yet.