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

[Problem/Bug]: visibilitychange doesn't fire when parent window is minimized or covered #4879

Open
pushkin- opened this issue Oct 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pushkin-
Copy link

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 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

  1. launch minimal app
  2. open devtools and execute document.addEventListener("visibilitychange", () => console.log(document.visibilityState), true)
  3. 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

@pushkin- pushkin- added the bug Something isn't working label Oct 23, 2024
@pushkin-
Copy link
Author

pushkin- commented Oct 23, 2024

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.

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

No branches or pull requests

1 participant