MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
452 stars 55 forks source link

Closing Windows Form with WebView2 control spawns popup WebView2 browser without firing NewWindowRequested #1198

Closed UsgsMonkey closed 3 years ago

UsgsMonkey commented 3 years ago

Description I have a windows forms application with a simple Windows form containing a WebView2 control. The principle is I want to push a specific URL to that browser to support a user login activity. The control performs perfectly for the login. However, when the user is on the final page and chooses to close the containing form, a WebView2 control popup immediately appears in the upper left of the screen pointing to the last address displayed in the original form control. This popup is only accessible to be closed via the Windows taskbar. I've tried listening to the NewWindowRequested event, following numerous workflows posted online without success (this event doesn't seem to fire at all).

NOTE: this behavior is observed when running the tool from Debug x86 in Visual Studio. We haven't tried a full deployment yet.

No error messages or exceptions are available for this issue.

Version SDK: Microsoft.Web.WebView2 Version 1.0.774.44 (installed via NuGet package manager) Runtime: Installed via Evergreen bootstrapper - Microsoft Edge WebView2 Runtime Version 90.0.818.39 visible in Control panel Framework: WinForms x86 class library launched internally from within ESRI ArcMap windows application as an ESRI ArcGIS Add-In tool (basically a WinForms app). OS: Windows 10 Enterprise (10.0.18363 Build 18363)

Repro Steps

Screenshots Screenshot #1: form at final login address indicating successful login (NOTE: this finall URI is an HTTP vs. an HTTPS address - i have no control over this) WebView2 Control Pre-Form-Close

Screenshot #2: popup that displays following close of Windows Form containing WebView2 control displayed in first screenshot WebView2 Unwanted Pop-Up Post-Form-Close

Screenshot #3: popup indicated in Windows taskbar WebView2 Unwanted Pop-Up displayed in Windows taskbar

UsgsMonkey commented 3 years ago

After posting this, I located issue #1079 and confirmed that calling .Hide() on the WebView2 control at the time I respond to the 'Close' button-click resolves the issue.

champnic commented 3 years ago

Thanks for the feedback @UsgsMonkey - we'll track the fix in #1079 as this indeed seems like the same issue. Glad the workaround is working for you!