Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Problem/Bug]: Find::Stop doesn't clear previous search term #5068

Open
pushkin- opened this issue Jan 28, 2025 · 4 comments
Open

[Problem/Bug]: Find::Stop doesn't clear previous search term #5068

pushkin- opened this issue Jan 28, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@pushkin-
Copy link

What happened?

I need to detect when a navigation happens in my app and clear the previous search term to prevent PHI/PII from being saved in there on the login screen for instance.

It seems that by default, the Find popup is closed but the contents are preserved. This is consistent with browsers, so this is fine as the default behavior.

But I was hoping that I could call Stop to fully stop/reset the Find session, but it doesn't help. The old search term persists.

Perhaps Stop is already called by WebView2 code on navigations and isn't intended to clear the old search term / reset to the default, but having some way of doing this would be useful. Perhaps a flag I can pass to the Stop function?

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

134.0.3101.0 canary

SDK Version

1.0.3079.0 prerelease

Framework

Winforms

Operating System

Windows 11

OS Version

23H2 - 22631.4602

Repro steps

can post an example if you'd like

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 Jan 28, 2025
@krbharadwaj
Copy link

@pushkin- Thanks for reaching out. I see this is a default behavior in edge browser as well.Could you please confirm?
Also please share the screenshots of the issue...

@pushkin-
Copy link
Author

pushkin- commented Feb 5, 2025

@krbharadwaj ok yes, the navigation not clearing the search term happens in Edge too. I called that out in the issue report. My report is specifically asking for a way to clear the search term, which I was hoping we could do with the Stop API, but maybe we need a new API here.

I suppose I could paste some screenshot here later, but it would just be of the Find popup with a search term in it which doesn't seem very helpful. Is there something in particular you're looking for here, or that you need clarification on?

@pushkin-
Copy link
Author

pushkin- commented Feb 7, 2025

@krbharadwaj I already do this.

When Ctrl+F is detected, I do:

var findOptions = coreWebView2.Environment.CreateFindOptions();
findOptions.FindTerm = string.Empty;
coreWebView2.Find.Stop(); // optional call I'm throwing in as a test
coreWebView2.Find.StartAsync(findOptions);

Ctrl+F opens with the old search term.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants