Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beforeunload: ScriptDialogOpening's deferral and/or args.Accept() is useless #3355

Closed
TomPMoleman opened this issue Apr 3, 2023 · 1 comment
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@TomPMoleman
Copy link

TomPMoleman commented Apr 3, 2023

According to the official documentation of the 'ScriptDialogOpening' event callback, the JS invocation shall be blocked in case you are requesting the deferral.
However, I noticed, that the deferral is completely useless for the 'beforeunload' kind.

Steps to reproduce:

Error behaviour:
Please note, that the ScriptDialogOpening event callback will be invoked, but regardless of fetching the deferral and/or invoking the Accept() function on the event args, the navigation will always take place.

Expected CORRECT behaviour:
The default JS dialog (shown upon setting 'AreDefaultScriptDialogsEnabled' to true) is showing a dialog with two options to either 'stay on the page', or to 'leave the page' and depending on the selection the navigation is either executed or aborted.
=> However, with the described error behaviour above in place, writing one's own code to reflect these two options won't be feasible (since the 'leave page' scenario will inevitably be the only outcome).

How to fix:
Just as for the other 3 kinds (alert, confirm & prompt) also for 'beforeunload', within the ScriptDialogOpening event callback, the deferral should block further execution and depending on calling the 'Accept()' function on the event args, the 'leave page' (accept was triggered) and 'stay on page' (accept was NOT triggered) options shall be reflected.

Affected version: 1.0.1185.39 (as used within Windows App SDK version 1.2.230217.4)

AB#44218030

@david-risney david-risney added bug Something isn't working tracked We are tracking this work internally. labels Apr 17, 2023
@monica-ch
Copy link
Contributor

@TomPMoleman Thanks for the bug report. We have fixed the issue in Edge canary 115.0.1830.0+. Please validate and let us know if you have more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

3 participants