Steps to reproduce the problem
Code snippet: confirmationDialogIssue.html
Issue video: https://drive.google.com/file/d/15R2esW1iJMAyEwXRNA98IoLtIB9_A5Cm/view?usp=drive_link
Reproduction Steps:
-
Create a page containing a single text input.
-
Register a beforeunload handler:
window.addEventListener("beforeunload", function(e) {
e.preventDefault();
e.returnValue = "";
});
-
Open this page in Edge.
-
Open another browser tab.
-
Switch to the second tab.
-
Click the browser Close (X) button to close the browser window.
-
Edge activates the first tab and displays the native "Leave site?" confirmation dialog.
-
Click "Cancel".
-
Click inside the text input.
-
Attempt to type.
Expected Result: The input should receive keyboard focus and accept typing after cancelling the native beforeunload dialog.
Actual Result: The input no longer accepts keyboard input.
Minimal Reproduction:
<!doctype html>
<html> <body>
<input type="text" placeholder="Type here">
<script>
window.addEventListener("beforeunload", function(e) {
e.preventDefault();
e.returnValue = "";
});
</script>
</body> </html>
Additional Details:
- Operating System: Windows 11 Enterprise
- Also reproduced in: Chrome (Chromium Issue: #537814749)
- Does NOT reproduce in: Mozilla Firefox
- The same behavior occurs in:
1. Plain HTML (no framework)
2. Angular 18 application
Steps to reproduce the problem
Code snippet: confirmationDialogIssue.html
Issue video: https://drive.google.com/file/d/15R2esW1iJMAyEwXRNA98IoLtIB9_A5Cm/view?usp=drive_link
Reproduction Steps:
Create a page containing a single text input.
Register a beforeunload handler:
window.addEventListener("beforeunload", function(e) {
e.preventDefault();
e.returnValue = "";
});
Open this page in Edge.
Open another browser tab.
Switch to the second tab.
Click the browser Close (X) button to close the browser window.
Edge activates the first tab and displays the native "Leave site?" confirmation dialog.
Click "Cancel".
Click inside the text input.
Attempt to type.
Expected Result: The input should receive keyboard focus and accept typing after cancelling the native beforeunload dialog.
Actual Result: The input no longer accepts keyboard input.
Minimal Reproduction:
Additional Details: