Skip to content

[Problem/Bug]: Find popup can no longer open after the Form is reshown after being hidden while the Find popup was showing #5164

Closed
@pushkin-

Description

@pushkin-

What happened?

  1. if I have a Find popup showing and the WebView2 control is hidden, the Find popup is hidden
  2. If I hide the Form that owns the Find popup (and optionally the WebView2 control afterwards), the Find popup stays visibile
  3. 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)

Gif of 2:
Image

Gif of 3:
Image

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;
		}
  1. start app
  2. press Ctrl+F and type some stuff in there optionally
  3. After 2 seconds, the Form will hide along with the Find popup
  4. After 2 more seconds, the Form will reshow
  5. 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtrackedWe are tracking this work internally.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions