There was a thread where the final part of it ended on saying that they were disabling the ctrl f default behaviour. Not a bug but it is agreeably a debatable choice.
@sam any reason why you can’t switch it to ctrl shift f (or any other shortcut)? I’m curious. Why the ctrl f choice anyways? Most people I work with rarely use the ctrl f in the browser, and the ones that do are people that care about shortcuts for the most part. Those people would care about learning ctrl shift f as a shortcut to search and would appreciate you not kidnapping the default behaviour.
CTRL F is essentially broken on many counts on any topic with more than 10 posts or so.
It still just seems so weird to take over a main browser shortcut. Just a thought, although I’m not sure I like it myself due to bloat. Let ctrl f be your custom implementation to search the page since the browser can’t help but trip over itself. And let ctrl shift f be the sitewide search. Thoughts?
post cloaking, means that a pile of posts are removed from the dom, so you search stuff and its just not there.
on top of that replaceState (happens on scroll) causes chrome to clear its currently active search resulting in real buggy behavior.
I much prefer focusing on improving our search function than trying to limp the built in one into a working state.
Same reason Google Docs captures Ctrl+F as well.
@phaedrus_one if you try to use in-page search on a Discourse topic with more than a trivial number of posts, you’ll find that most of the posts are not loaded in the browser. So on-page search isn’t going to do squat for you.
So I believe, very strongly, that this is a correct behavior.
I don’t understand how to search the topic I’m in. Hitting ctrl-F brings up a search of topics, not a search of the topic I’m on.
If you’re in a topic less than 10 posts, until automatic scroll-highlighting is done, and with a high enough slack ratio, you can hit ctrl-F twice for the default search.
It does a search of the topic you’re in first, and then a search of topics. This is what I get in this topic:
Ahh, I see now. I don’t understand the use-case for combining those two features under one control though. I either want to search the text of the topic I’m on, or I want to search the list of topics.
There’s been a fair amount of confusion around the posts/topics search results… maybe when the results are posts within a thread the results header shouldn’t say “topics”?
I made a bunch of tweaks today.
- CTRL-F is only kidnapped on Topic/Topic List/User Activity pages.
- Topic search will highlight the work you are searching for
- Topic search will work even with only 1 post
- Clicking between results within a topic will not hide the search dialog
Hopefully this makes this less painful
It now says “results” instead of “topics”.
For the record, I would really like to see the exact functionality of CTRL-F eventually (i.e. post-1.0) replicated and implemented as a “Jump to word” search option that’s defaulted to when search is accessed via CTRL-F, because:
- CTRL-F is a very different type of search from a data-base search. For instance, @techAPJ recently made an edit to his tutorial saying he’d added a section about FooBar. I tried to CTRL-F for it, but all that gets me is his full 20 paragraph post.
- Even though CTRL-F is a geek’s tool, the type of search is very useful and I sorely wish more people knew about it. Every time I show this little trick to one of my friends they go “What? What did you just do? You can do that!?”. Discourse could encourage it’s use by incorporating it into the search dialogue.
I’ll make a mockup when I’m not feeling lazy.
It already works that way, click on the result. The target words are highlighted and will be moved into focus.
Actually it looks like the results aren’t moved into focus, just the individual post. For longer posts that behavior is not nearly as useful as the browser’s behavior jumping to the actual word.
Trying to duplicate the browser’s functionality this way seems like a tricky task, given that some browsers implement search differently than others. For example in Chrome, if the first result isn’t what I’m looking for, I usually hit enter to go to the next result. Discourse’s search functionality doesn’t work that way.
I’d like to second this being an issue. The override seems OK for finding if something is in a thread, but not so good for finding where. A lot of forum visits come from search engine results where the visitor already knows the text they’re looking for because they saw it in the preview. If search words are meant to be highlighted and moved into focus, that would solve the problem, but at the moment that doesn’t seem to be happening (I’m using Chrome 36).
Imagine Jimmy wants to know how to pin a topic on a Discourse forum. He searches Google for pin topic discourse or whatever, and he sees a result with a text preview saying “…icon in the upper right to get the staff menu for the topic; select Pin Topic.”
That looks right, so he ends up here: http://www.phylobabble.org/t/discourse-admin-quick-start-guide/3
That’s a big post, so he Ctrl-F searches for “pin topic”. Normally his browser would already be highlighting the text in the post, but nothing happens, so he tries clicking on the only result. This just refreshes the page and puts him back at the same post.
At this point Jimmy either leaves the forum to try another result that doesn’t hijack his browser search, combs the whole thread manually, or mashes Ctrf-F enough that he discovers the Ctrl-F-F override and types “pin topic” again, instantly highlighting the section that he wanted all along.
We changed it so that ctrl+f triggers Discourse search only when there are more than 20 posts loaded in the current topic stream.
So on smaller topics, this now works like the browser default.
Only on larger topics will you get Discourse search, which is necessary because not all posts are loaded in the DOM (think 100+ replies) at any given time, only the visible ones are.
Sweet, that sounds logical.
This is now complete, we only take over CTRL F when we have no other choice but to do so.