MicrosoftEdge / MicrosoftEdge/WebView2Feedback
CoreWebView2ScriptDialogOpeningEventArgs should return 'false' when 'confirm' dialog is not Accept()-ed
@Master-Ukulele is already working on this.
Since Sep 22, 2023.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Originally opened by @OMendozaG here: https://github.com/microsoft/microsoft-ui-xaml/issues/8413
###Describe the bug
But with CoreWebView2ScriptDialogOpeningEventArgs, you cannot tell it that it has not been intercepted and to finally launch the original, okay, this is not a bug, it is a feature proposal.
What is a bug, though, is that CoreWebView2ScriptDialogOpeningEventArgs has an Accept but no cancel. Therefore, in the case of a Confirm,
if (e.Kind == CoreWebView2ScriptDialogKind.Confirm) {
if (Confirm(e.Message)) {
e.Accept();
}
}
There is no way for the confirm to return FALSE. Because if you not fire Accept, return of confirm( on javascript will be null.
This does not give me the tools to substitute the original behavior of Confirm since it can result in true or false.
Yes, I could do a workaround and intercept the result by JavaScript and if it is === null, transform it to false. But that is not a solution. CoreWebView2ScriptDialogOpeningEventArgs should allow me to substitute the original behavior of the events.
Also, as I said before, I do not understand why it does not have a return property that allows me to launch the default event despite having intercepted it.
###Steps to reproduce the bug
Create a WebView2
Intercept ScriptDialogOpening
Try to return false on the javascript confirm call.
###Expected behavior
Confirm dialog, by default, can be true or false.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.