Hacker News new | ask | show | jobs
by mschuetz 2307 days ago
> Perhaps intercepting Ctrl+F

Please don't ever do that. I know one site that does this and I hate it.

3 comments

Google Docs does this, e.g. in a spreadsheet. I think it's reasonable in that context.

For what it's worth, if you really need to search e.g. "View" to figure out where the View menu is, the OS-native menu option still works.

For applications that's fine. I'm mostly refering to traditional websites/forums that should never do this.
Discourse [1], popular forum software, does this as well.

[1] https://www.discourse.org/

Not a fan either, but at least it allows you to repeat the keystroke to do a native page search.
This is infuriating. Every time I CTRL+F on Discourse I get upset.
At one point I had a user script that prevented certain key combinations from being intercepted. Worse than discourse is a hosting platform I was encountering frequently for a while, where pressing esc to stop the page from loading instead caused the website to switch pages to a login prompt for the site owner. Other offenders that annoy me include intercepting alt+d (focus address bar), Ctrl+n (new window, outlook captures this), Ctrl+t (new tab), Ctrl+a (select all), and other common keyboard functions.

Fix: Just add a dummy onkeyup function to the document root and body elements, and set @match rules for whatever sites annoy you. Occasionally you'll also need the more generic event handler function as well.

It shouldn't be possible. That the browsers allow it is the real problem. Same with forced unmounting of resources from the DOM.