dehijack the find

When I do the keystroke my browser designates as being for searching the current webpage for some text, normally, the browser will bring up a search the page function. But, on this website, the keystroke is hijacked to search the entire website. I feedback that it should not be so.

4 Likes

Yeah, that’s true, but I think it’s standard for Discourse.

At least in Firefox, if you use the toolbar menu, you can get the old “Find in page”…but if it’s a long thread, I think you’re limited to how much of the thread you’ll actually be searching.

Not sure if the browser will search what’s in cached memory, or if you can “Work Offline” and search that way.

1 Like

I’m with you here. Discourse is way, WAY too JavaScript heavy. A simple web forum should function with JavaScript completely disabled, and I’d happily trade all the dynamic notification badges and other bells and whistles for that.

As far as I know, an add-on like Grease Monkey is the only solution – something that lets you intercept JavaScript and selectively deny stuff you don’t like, but it’s not for the faint of heart.

2 Likes

Agreed, I find hijacking normal browser shortcuts completely unacceptable. Once I really wanted to check a long thread for a term and I ended up going to View Source Code and searching THAT. It’s f*&$ing ridiculous.

2 Likes

This is odd, when I do CTL+F it brings up the browser page search (Firefox/Windows). But I recall it doing what you describe, defaulting to the Discourse search instead. Not sure how I switched it over, or even if I did anything to make that happen. Curious indeed.

1 Like

+1

I’ve only tried this in Safari so far, but browser find still works there. I’m not aware of a preference on either side that would affect that but I’ll test other browsers & platforms when I have a chance.

huh… just tried it again on this page and got the browser standard Find box instead:
image

So I went to another random thread, tried it and got hijacked again.

image

I’m not sure what’s worse, having it hijacked all the time or having it hijacked apparently at random?

1 Like

FWIW I’m just getting the standard browser find box with Chrome.

1 Like

Bizarre, I’m getting that too. The box works as expected here, but on a couple other threads it opens Discourse search. Funky.

I’ve also gotten used to the “hijack” of command/ctrl-F in this forum, but in this thread it’s not working. Apparently the forum paying attention to the topic. It’s on to us.

By the way, even when the script is capturing the search keystroke, you can (less conveniently) click your edit menu and select “find” to search in the page.

So odd that it’s not working consistently… when I saw my regular “find” box pop up I expected to find a post from Lesley announcing she’d disabled this.

2 Likes

It’s even weirder than I first thought it was. In general, I get the browser find when I use the key command … except for the occasional page where I only get Discourse find … or the even more occasional page where I get browser find if I click on the browser header/frame before typing the key command and Discourse find if I click in the page area itself first.

2 Likes

That is so strange. I get the inconsistent behaviour as well from the links you provide. Yet the browser console shows no difference in the page loads. It doesn’t appear that some script is loading on one page and failing on another, which might point to the lack of keystroke interception in various places. It’s a puzzler.

2 Likes

I think it’s something to do with the number of replies? Threads with 20 or less posts seem to bring up my browser’s (Chrome) search, anything higher and I see the Discourse search. I did not test extensively :slight_smile: Perhaps as @jimmy_two_times hinted, this might be to facilitate searching parts of the thread that haven’t loaded to the local client yet/the user hasn’t scrolled up.

I agree that hijacking browser keyboard shortcuts is not ideal from a UX perspective; if it was optional, I would definitely switch it off.

3 Likes

Can confirm, over 20 posts is when it starts happening. I think discourse loads a maximum of 20 posts at a time. I think it’s giving you the discourse search to cover the entire thread so you don’t miss results that haven’t been loaded.

Still a bit jarring sometimes, but at least now I see the logic.

3 Likes

So it’s internal logic in the code. Nice detective work!

I noticed on one page linked earlier - Least plausible protagonist? - that hitting CTL+F brings up the Discourse search, but if I then press it again, it changes to the browser search. I’ve noticed this second keystroke works on other pages as well. So it’s a further way to get to the browser search.

1 Like

So it probably has something to do with ajax and the infinite scroll. Bleh. Boo.

Appreciate the workarounds people have suggested – hard to overcome 20 years of muscle memory but the “do it twice” thing might work for me.

4 Likes

Interesting. I didn’t even think about post counts.