Which @angular/* package(s) are the source of the bug?
zone.js
Is this a regression?
No
Description
When zone.js is not loaded, returning a value in beforeunload event handler causes the browser to ask for confirmation: https://jsfiddle.net/datbth/b57ur4ky/45/
When zone.js is loaded, returning a value in beforeunload event handler does nothing: https://jsfiddle.net/datbth/b57ur4ky/44/
Reproduction steps:
- Visit the jsfiddle link
- Click Bind Event
- Click Reload
- Expected result: browser asking for confirmation

Please provide a link to a minimal reproduction of the bug
https://jsfiddle.net/datbth/b57ur4ky/44/
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
Chrome Version 105.0.5195.125 (Official Build) (64-bit)
Ubuntu 22.04.1 LTS
Zone.js 0.11.8
Anything else?
I know that practically almost all browsers are supporting preventDefault and returnValue to negate the unload (ref). But my bigger concern is about how zone.js is handling the return values of event handlers and whether it breaks other events as well.
Which @angular/* package(s) are the source of the bug?
zone.js
Is this a regression?
No
Description
When zone.js is not loaded, returning a value in
beforeunloadevent handler causes the browser to ask for confirmation: https://jsfiddle.net/datbth/b57ur4ky/45/When zone.js is loaded, returning a value in
beforeunloadevent handler does nothing: https://jsfiddle.net/datbth/b57ur4ky/44/Reproduction steps:
Please provide a link to a minimal reproduction of the bug
https://jsfiddle.net/datbth/b57ur4ky/44/
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version)Anything else?
I know that practically almost all browsers are supporting
preventDefaultandreturnValueto negate the unload (ref). But my bigger concern is about how zone.js is handling the return values of event handlers and whether it breaks other events as well.