-
Notifications
You must be signed in to change notification settings - Fork 683
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
Webview2: Window blur and focus event always firing when clicking a button #5615
Comments
@koenvd This sounds like it might be a known issue where the WebView2 control thinks it loses focus when the Edge WebView2 inside it gets focus. It's something I'm actively working on -- clearly it has a lot of unfortunate side effects, like (probably) this one. |
FYI but this also works on UWP with the backported Webview2 part of WinUI 2.7.0-prerelease.210827001. |
FYI but still seems to fail with WindowsAppSdk v1.0.0-preview1. |
Fixed in Windows App SDK 1.0.1, check out the release notes for more info. |
When clicking a button the blur and focus event always seem to fire on the window.
Steps to reproduce the bug
Expected behavior
Number should only increase for button clicks.
Other numbers should only increase if the focus is moved outside or back to the window.
Screenshots
Screenshot from WinUI app after clicking the button twice. Notice the blur and focus event being triggered as well.
Screenshot from Edge browser after clicking the button twice. Notice the blur event not being triggered and the focus event triggered once when user clicks the button and at same time gives focus to the window.
Version Info
Packaged WinUI3.0 Desktop app, WindowsAppSDK 8.0
NuGet package version:
WinUI 3 - Windows App SDK 0.8: 0.8.0
Windows app type:
Additional context
This is imporant since now in our web app we listen to the blur event on the window to close some modal dialogs automatically when the focus moves to another window. This issue prevents the user of just clicking on the button because the dialog is already closed at the moment the button click event is being handled.
Also this works both in Edge and a Win32 C++ app (taken from here https://github.com/MicrosoftEdge/WebView2Samples/tree/master/SampleApps/WebView2APISample) so seems related to WinUI3.0. Hence I'm reporting it here instead of on the Webview2 feedback repo.
The text was updated successfully, but these errors were encountered: