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]: Find popup can no longer open after the Form is reshown after being hidden while the Find popup was showing #5164

Open
pushkin- opened this issue Mar 13, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@pushkin-
Copy link

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

@pushkin- pushkin- added the bug Something isn't working label Mar 13, 2025
@pushkin- pushkin- changed the title [Problem/Bug]: Find popup can't open when the Form is hidden and reshown [Problem/Bug]: Find popup can no longer open after the Form is reshown after being hidden while the Find popup was showing Mar 13, 2025
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

2 participants