WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Feature]: Provide a public API to programmatically close the default find/search bar in Webview2

Open sbasuli opened this issue 4 months ago • 1 comments

Describe the feature/enhancement you need

Product: Microsoft.Web.WebView2 (WPF/.NET 8) Description: When using the default find/search bar in WebView2, there is no supported way to programmatically close or hide the bar. • The CoreWebView2 API does not expose a method like StopFind or CloseFindBar. • Sending synthetic ESC key events (via SendInput, SendMessage, or similar Win32 APIs) does not close the find bar, even when the WebView2 control has focus. • Only a real, physical ESC key press by the user closes the bar. Expected Behavior: There should be a public API to programmatically close the default find/search bar, or synthetic input should be processed the same as real user input.

Actual Behavior: • No API exists to close the find bar. • Synthetic ESC key events are ignored by the Chromium input pipeline. • The only workaround is to suppress the default find UI and implement a custom one, which is not always desirable.

Steps to Reproduce:

  1. Open a WebView2 control in a WPF app.
  2. Show the default find/search bar (Ctrl+F).
  3. Attempt to close it programmatically using SendInput or SendMessage with ESC.
  4. Observe that the bar remains open. Workarounds Tried: • SendInput and SendMessage with ESC key. • Focusing the WebView2 control before sending input. • Searching for any public API to close the find bar.

The scenario/use case where you would use this feature

There are some use-case in my application where search bar is opened in one page. Then user is navigating to another page where serchbar is not expected to be visible. This is a customer complaint.

How important is this request to you?

----Please select----

Suggested implementation

Request: Please provide a public API to programmatically close the default find/search bar, or document a supported way to do so. Environment: • WebView2 SDK: [your version] • .NET: 8.0 • OS: [your OS version] • WPF

What does your app do? Is there a pending deadline for this request?

No response

sbasuli avatar Sep 24 '25 07:09 sbasuli

This feature is very much needed for our customer. The issue has been hanging for a long time, and according to the customer, the search window is making the application unresponsive while user is navigating from one page (where serch window was opened) to another page (where we would like to close the search window). Please prioritize this request, as it is affecting our production usage.

sbasuli avatar Sep 24 '25 07:09 sbasuli

There seems to issue in the functioning of the Search bar and needs investigation

  1. Synthetic ESC key events not leading to dismissal of the search bar
  2. Search bar should exit upon new page navigation which is not

Lakshmisha-KS avatar Nov 27 '25 07:11 Lakshmisha-KS

Hi Lakshmisha-KS,

I did not understand your comment clearly. I agree that there are issues. Are you going to solve it soon?

Regards, Sharad

sbasuli avatar Nov 27 '25 07:11 sbasuli