Closed
Description
What happened?
- if I have a Find popup showing and the WebView2 control is hidden, the Find popup is hidden
- If I hide the Form that owns the Find popup (and optionally the WebView2 control afterwards), the Find popup stays visibile
- If I switch the order and hide the WebView2 control before the Form, the Find popup disappears, but when the Form is reshown, Ctrl+F no longer shows the Find popup (i.e. the StartAsync API is broken)
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Prerelease (Edge Canary/Dev/Beta)
Runtime Version
136.0.3192.0 canary
SDK Version
3116.0
Framework
Winforms
Operating System
Windows 11
OS Version
24H2 - 26100.3194
Repro steps
Download the minimal webview2 WinForms sample
To WebView2Control_CoreWebView2InitializationCompleted
in BrowserForm.cs
, add:
this.webView2Control.CoreWebView2.Settings.AreBrowserAcceleratorKeysEnabled = false;
this.webView2Control.KeyDown += WebView_KeyDown;
And define the handler like so:
private void WebView_KeyDown(object sender, KeyEventArgs e)
{
var wv2 = (WebView2)sender;
if (e.KeyCode == Keys.F && Control.ModifierKeys.HasFlag(Keys.Control))
{
e.Handled = true;
DoFind(wv2);
}
else if (e.KeyCode == Keys.F12)
{
e.Handled = true;
wv2.CoreWebView2.OpenDevToolsWindow();
}
}
private void DoFind(WebView2 wv2)
{
var findOptions = wv2.CoreWebView2.Environment.CreateFindOptions();
wv2.CoreWebView2.Find.StartAsync(findOptions);
Task.Delay(2000).ContinueWith(t =>
{
this.Invoke(() =>
{
ToggleVisibility(wv2, false);
});
Task.Delay(2000).ContinueWith(t2 =>
{
this.Invoke(() =>
{
ToggleVisibility(wv2, true);
});
});
});
}
void ToggleVisibility(WebView2 webView2, bool visible)
{
webView2.Visible = visible;
this.Visible = visible;
}
- start app
- press Ctrl+F and type some stuff in there optionally
- After 2 seconds, the Form will hide along with the Find popup
- After 2 more seconds, the Form will reshow
- Ctrl+F will no longer open the Find popup
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