I sometimes want to use the browser search window within topics since the Discourse search function jumps only to posts and not the exact position of the search term. Pressing Ctrl+F works quite well.
However, the Discourse search window doesn’t close automatically when I use the browser’s search function. The first few search results therefore are often within the search window. That’s quite annoying.
Hmm… That may be easier said than done. As by default the keyboard keypress framework that Discourse uses, doesn’t capture keypresses that are made in input boxes (which is why pressing it twice works).
So there is nothing capturing the second pressing of it. And if we did, you’d have us capturing it instead of the browser responding to it… So its a bit of catch-22 here.
Thanks for your PR. Unfortunately it doesn’t work the way I imagined, but I guess that’s because I didn’t exactly describe the behavior I wanted. I’ll clarify it:
Expected behavior: When I press Ctrl+F the second time, the Discourse search window should close automatically and the browser’s search window should be visible and have focus.
Current behavior without the PR: When I press Ctrl+F the second time, the Discourse search window stays open and the browser’s search window is visible and has focus.
Behavior with the PR: When I press Ctrl+F the second time, the Discourse search window closes, but there is now browser search window.
@gerhard thanks for clarifying I do find the proposed behavior to be confusing for users as I’m not sure how we can clearly bring across the behavior to users that pressing Ctrl + f twice will first bring up Discourse search and then the browser’s search.
But that is exactly what is happening if you press Ctrl+F in a topic with lots of posts. Try it out yourself by pressing it inside a topic with more than 20 posts.
And it is good that this is happening since I want to be able to search using my browser. It has a better search experience. My problem right now is that the Discourse search window stays visible and I get lots of search results from the browser that are within Discourse’s search results. See my screenshot in the first post.
I do understand what you mean and I believe the browser’s search appearing is a bug since Discourse has made the decision to hijack the search on the first ctrl+f.