Hijacking the default browser key combination Ctrl+F?

It seems to me that your use of Ctrl+F as a dedicated search tool for ArtOfMemory might violate the W3C standards.

I was using that key combination long before the internet was invented by Al Gore.

I’m now out of touch with web standards, but I think “W3C” was the standard. The following random page gives a high-level discussion of the rationale - but without the standards:

In fact your use of Ctrl+F only works on SOME of the AoM pages. The default browser usage (Chrome in my case) works on the other AoM pages. So your usage is not even consistent.

Here’s the page that attracted my attention:

On that specific page, I see no value being added by overwriting the browser default.

Here’s a page (this page) where the W3C usage is implemented:

https://forum.artofmemory.com/c/news-and-feedback

Thanks.

2 Likes

It’s a tricky problem due to the nature of the way the forum posts load. I also found it a bit strange at first, but came up with a workaround (see the “How to Fix” section below).

The technical reason

Because a page/thread can contain an unlimited number of posts, the posts don’t load until you scroll down, and when you scroll down, the posts above are removed from the top of page to save memory. Even if a desktop computer can handle that much load, mobile browsers can’t.

Since not all of the content of a page is rendered at once, the browser’s search box won’t always find content on the page, even if it’s in that thread and you just saw that text on your screen a moment ago before scrolling down.

Here’s an example:

In the speed card times thread, there are over 1,300 posts, and they all appear on the same page. When you first open the thread, it won’t load all 1,300+ posts, because it would be too heavy of a load for the browser. Keep an eye on the browser’s scrollbar as you drag it around:

So if you search with the browser’s search box it won’t be able to search through all of the text on the current “page”.

(This forum is actually something like a cross between a website and an app. You can install it on your phone by opening it in a browser and clicking the “add to home screen” button. On Android, the option should be next to the address bar. On iPhones, that option might be hidden inside of the “share” menu.)

Standard keybindings

ctrl-f is a common convention for “find” with some operating systems and programs, but it isn’t standard across browsers or computers. (W3C standards apply more to the data that is sent over the network than the user interface of the browser itself.)

Examples: on Mac, the default keybinding for searching (including Google Chrome) is command-f. In many programs the default is a / (a slash, also works in browsers), ctrl-g (works in browsers, at least on Linux), or ctrl-s (Emacs style). In unix-based operating systems, ctrl-f moves the character forward one space. In Microsoft Outlook, I think ctrl-f forwards emails instead of searching. In some programs, ctrl-f scrolls forward by one page (Vim style).

Why it only happens on some pages

If you don’t see the override on certain pages, it’s probably due to what part of the browser has focus. If you’re focused on the page itself (by clicking it), the site’s search box will open. If the mouse pointer is focused in the browser’s address bar (or some other part of the browser), then it will use the browser’s built-in search box.

How to fix it

A workaround that I use to get to the browser’s search box is to hit ctrl-l (lowercase “L”) to move the focus to the address bar and then ctrl-f. Another way to bypass it is to use ctrl-g.

If that solution doesn’t work for you, I could figure out a way that you could override it using a browser extension, but if you do regularly bypass it by using the browser’s search box, remember that the browser might not find the text, even if it’s “on that page” just a few posts away from your current viewing position.

1 Like

The custom Ctrl-F behavior is only used on topics with more than 20 posts - if there are fewer, all the data is in the DOM so the browser’s regular Find functionality is fine.

Also, another way to get the regular Ctrl-F behavior is to press Ctrl-F twice. But as @Josh mentioned, the browser’s normal search will generally be buggy if there are lots of posts.

1 Like

Thanks for the detailed response.

That sounds reasonable. But maybe that’s the reason why high-traffic forums such as TenForums allow only a fixed number of posts per page (ten posts for TenForums, seven posts for SevenForums, and so on).

Of course, they try to level the playing-field by forcing you to click the page-number widget countless times just to arrive at the latest post - maybe to generate advertising revenue. Someone should invent the idea of placing the latest post first - as in emails.

If you ever decide to implement a page slicer, let me know, and I’ll give you some more gotchas to avoid.

1 Like

.
@Josh suggested some alternative key bindings, but I think always using Ctrl-F as the first choice is completely fail-safe:

  • If the default browser search box appears, then there are less than 21 posts. OK.
  • If the AoM search box appears, then there are 21+ posts. Again OK.

Thanks.

1 Like