79783501

Date: 2025-10-06 09:19:57
Score: 0.5
Natty:
Report link

When a <dialog> element is closed using the Escape key, the returnValue property is not modified. According to the HTML specification, returnValue only changes when the dialog is closed through a form submission (for example, by pressing a <button> within a <form method="dialog">). In that case, it takes on the value of the button that triggered the close.

If the dialog is canceled by pressing Escape, it simply closes without altering returnValue. Therefore, the value remains whatever it was previously—typically an empty string if it was never set, or the last assigned value if it was set earlier.

In practice, this means that Firefox’s behavior, where the returnValue remains "no" after reopening and pressing Escape, aligns with the specification. Chrome’s behavior, where it resets to an empty string, does not.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When
  • Low reputation (1):
Posted by: Ian Davis