-
Notifications
You must be signed in to change notification settings - Fork 23k
Description
MDN URL
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog
What specific section or headline is this issue about?
Handling the return value from the dialog
What information was incorrect, unhelpful, or incomplete?
"If the dialog is closed by pressing the Esc key, the returnValue is not updated, and the close event doesn't occur"
What did you expect to see?
If this were true, in the live example that follows, closing the dialog with Escape should not change the Output content. However, at least for Windows on Chrome, the Output is set to "ReturnValue: ." indicating that the close event is getting triggered and the dialog returnValue is getting set to empty string.
I don't know if this might be specific to Chrome or Windows or something. Maybe its behavior is against spec. I certainly think that Escape triggering the close event and setting the returnValue is much preferable to it doing neither, at any rate.
But even if it were somehow due to the spec not being appropriately adhered to, it would still be very important to clarify in this documentation that the statement "If the dialog is closed by pressing the Esc key, the returnValue is not updated, and the close event doesn't occur" does not necessarily hold true, and should not be relied on for production code.
And if it turns out the statement is just entirely outdated or incorrect, then it can simply be removed or appropriately edited.
Do you have any supporting links, references, or citations?
Only my own firsthand observation.
Do you have anything more you want to share?
No response
MDN metadata
Page report details
- Folder:
en-us/web/html/reference/elements/dialog - MDN URL: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/html/reference/elements/dialog/index.md
- Last commit: f2d281d
- Document last modified: 2025-08-06T09:01:21.000Z