Skip to content

[Problem/Bug]: Find:StartAsync clears existing entry on a delay when passing a new FindTerm in #5178

@pushkin-

Description

@pushkin-

What happened?

If I trigger the Find popup and pass in a starting search term like this:

 var findOptions = wv2.CoreWebView2.Environment.CreateFindOptions();
 findOptions.FindTerm = "a";
 wv2.CoreWebView2.Find.StartAsync(findOptions);

It takes a second or so for the previous search term to be replaced by the new one, so there's a moment where the user can still see the old term.

If you set the FindTerm to be longer (findOptions.FindTerm = "aaaaaaaaaaaaaaaaaaaaaaaaa";), the change becomes near-instantaneous.

Importance

Low. My app is not very affected, or this only affects development.

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

136.0.3216.0 canary

SDK Version

3116.0

Framework

Winforms

Operating System

Windows 11

OS Version

24H2 OS Build 26100.3476

Repro steps

  1. open sample WinForms app
  2. In WebView2Control_CoreWebView2InitializationCompleted, add this.webView2Control.CoreWebView2.Settings.AreBrowserAcceleratorKeysEnabled = false;
  3. In WebView2Control_KeyDown, add this code:
if (e.KeyCode == Keys.F && Control.ModifierKeys.HasFlag(Keys.Control))
{
     e.Handled = true;

         var wv2 = (WebView2)sender;
	var findOptions = wv2.CoreWebView2.Environment.CreateFindOptions();
	findOptions.FindTerm = "a";
	wv2.CoreWebView2.Find.StartAsync(findOptions);

}
  1. Run the app
  2. press ctrl+f
  3. type some text in there
  4. close the popup
  5. press ctrl f
  6. notice the text you typed is still in there and gets replaced with "a" in a second
  7. If you make the FindTerm longer (e.g. "aaaaaaaaaaaaaaaaaaaaaaaaa"), the change happens more quickly

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