WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: Blank window after navigate in hidden state

Open alervd opened this issue 1 year ago • 5 comments

What happened?

In our app, we are trying to start using WebView2 instead of CEF for displaying our main window's UI. At app start, we show a splash screen, calling navigate and waiting for the navigate to complete. The browser window is hidden (SW_HIDE) while navigating. Once navigation is complete, we show the browser window (SW_SHOW). Result: its window is blank. It shows nothing. It also does not react on mouse clicks in any way (e.g. does not show context menus).

Is it an expected behavior? Can it be disabled then? What are possible workarounds?

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Win32

Operating System

Windows 10

OS Version

No response

Repro steps

You can easily reproduce this behavior on sample apps (e.g. Win32_GettingStarted). For this, you need to modify Win32_GettingStarted project code in the following way:

  1. Add a call to CoInitialize(0).
  2. Change ShowWindow's mode to SW_HIDE.
  3. Add NavigationCompleted handler and show window in it (SW_SHOW).

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

alervd avatar Aug 22 '24 09:08 alervd

@champnic could this be somewhat related to this issue https://github.com/MicrosoftEdge/WebView2Feedback/issues/1077?

victorhuangwq avatar Aug 26 '24 21:08 victorhuangwq

I too am facing the same issue. Did you find any workarounds for this? @alervd

mhdshameel avatar Aug 27 '24 13:08 mhdshameel

@mhdshameel Yes, I temporarily show the window outside of the visible screen space and then hide it again once I get my callback with webview2 called.

alervd avatar Aug 28 '24 08:08 alervd

@mhdshameel Yes, I temporarily show the window outside of the visible screen space and then hide it again once I get my callback with webview2 called.

I have fixed it by using the webviewcontroller::put_IsVisible(true). Basically all the logistics stuffs are handled by the controller, so you can hide and let the navigation complete and show using this api of the wv2 controller

mhdshameel avatar Aug 28 '24 11:08 mhdshameel

@mhdshameel put_IsVisible(true) works? Well, it's a something I should try too :)

alervd avatar Aug 28 '24 19:08 alervd