Skip to content

[Problem/Bug]: Find popup inherits search term from Find popups in other windows #5158

Open
@pushkin-

Description

@pushkin-

What happened?

When I open the Find popup and type in a search term, and then open the find popup in another window, it inherits the same search term.

I would like to get a fresh popup without any search query in it.

I realize this behaviors happens in browsers as well, but I was hoping that if I pass FindTerm = string.Empty into the find options, it would cause the query to be cleared out, but that doesn't happen. Though when I close the popup in the second window and reopen it, then the search term does get cleared out, which seems to relate to #5068 (comment)

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

133.0.3065.92

SDK Version

1.0.3079.0 prerelease

Framework

Winforms

Operating System

Windows 11

OS Version

24H2 - 26100.3194

Repro steps

  1. launch app and open Find popup and search for something
  2. window.open another window and open the Find popup
  3. it will show the search term from the other window despite passing in a new set of find options to StartAsync.

This partially repros in Edge (Ctrl+F in Edge will show a popup that uses the previous search term), but the difference is that reopening it doesn't clear out the term, whereas doing that in WebView2 does. I expect that since I have a StartAsync API where I can control the search term, passing an empty string would work around this, but it doesn't.

Added zip below. The gist of the code is I disable accelerator keys and attach a keydown on the main and secondary webview2 controls which does:

private void WebView_KeyDown(object sender, KeyEventArgs e)
{
     var wv2 = (WebView2)sender;
     if (e.KeyCode == Keys.F && Control.ModifierKeys.HasFlag(Keys.Control))
     {
           var findOptions = wv2.CoreWebView2.Environment.CreateFindOptions();
            wv2.CoreWebView2.Find.StartAsync(findOptions);
            e.Handled = true;
     }
}

WebView2WindowsFormsBrowser_CtrlFIssue.zip

Repros in Edge Browser

Yes, issue can be reproduced 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