diff --git a/files/en-us/web/html/reference/elements/dialog/index.md b/files/en-us/web/html/reference/elements/dialog/index.md
index 7f5af8bbb7f82e9..feeae55cf29ad25 100644
--- a/files/en-us/web/html/reference/elements/dialog/index.md
+++ b/files/en-us/web/html/reference/elements/dialog/index.md
@@ -273,9 +273,9 @@ When the modal dialog is displayed, it appears above any other dialogs that migh
This example demonstrates the [`returnValue`](/en-US/docs/Web/API/HTMLDialogElement/returnValue) of the `
-
+
@@ -327,12 +327,14 @@ showButton.addEventListener("click", () => {
favDialog.showModal();
});
-// "Cancel" button closes the dialog without submitting because of [formmethod="dialog"], triggering a close event.
+// "Cancel" button closes the dialog without submitting because of [formmethod="dialog"]
+// or `favDialog.close()` was called, triggering a close event.
+// Or "Esc" was pressed, followed by a cancel event, which is also followed by a close event.
favDialog.addEventListener("close", (e) => {
outputBox.value =
- favDialog.returnValue === "default"
- ? "No return value."
- : `ReturnValue: ${favDialog.returnValue}.`; // Have to check for "default" rather than empty string
+ favDialog.returnValue === ""
+ ? "No return value." // returnValue had its default "" starting value, or the select box's "Choose…" option's "" value
+ : `ReturnValue: ${favDialog.returnValue}.`;
});
// Prevent the "confirm" button from the default behavior of submitting the form, and close the dialog with the `close()` method, which triggers the "close" event.