You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The visibilitychange event doesn't fire when the window hosting a webview2 control is minimized or covered by another window. This works correctly in Electron, because they handle it themselves
The closed issue said "currently, it's by design" and proposed a workaround (for just the minimize issue, not the other one).
I think it would be nice if they baked this workaround into WebView2, so the browser events fire as expected, by checking the hosting window.
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
129.0.2792.89
SDK Version
1.0.2535.41
Framework
Winforms
Operating System
Windows 11
OS Version
22631.4317
Repro steps
launch minimal app
open devtools and execute document.addEventListener("visibilitychange", () => console.log(document.visibilityState), true)
minimize the window or cover it fully by another window and notice that you don't get any logs
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered:
And handling the other case and detecting when a window is covered by another seems to require a timer that fires periodically and sets WebView::Visible to false when covered. This means that when you uncover the window, there will be a period of time when it's just black.
Making the timer fire way more frequently (and same for other windows) seems suboptimal.
Additionally, when the Form is owned by another Form, and the parent Form is minimized (hiding the child Form), the child Form's WebView2's Visible property is set to false, but the visibilitychange event doesn't fire, so I have to work around this by detecting when the parent Form is minimized, and then setting the child Form's webview's Visible to true and then back to false.
What happened?
Reopening this issue: #2681
The
visibilitychange
event doesn't fire when the window hosting a webview2 control is minimized or covered by another window. This works correctly in Electron, because they handle it themselvesThe closed issue said "currently, it's by design" and proposed a workaround (for just the minimize issue, not the other one).
I think it would be nice if they baked this workaround into WebView2, so the browser events fire as expected, by checking the hosting window.
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
129.0.2792.89
SDK Version
1.0.2535.41
Framework
Winforms
Operating System
Windows 11
OS Version
22631.4317
Repro steps
document.addEventListener("visibilitychange", () => console.log(document.visibilityState), true)
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered: