djangoproject.com icon indicating copy to clipboard operation
djangoproject.com copied to clipboard

Change searchbox shortcut to ctrl-k/command-k, and make it visible

Open adamchainz opened this issue 3 years ago • 7 comments

One can press the / key to focus the search box, but this is a secret feature. We should surface this - perhaps as easy as changing the search box's placeholder text, or by adding a small <kbd> element as can be seen on tailwind and bootstrap.

adamchainz avatar Sep 22 '21 08:09 adamchainz

I find this feature very annoying. Most of the time I use / key to start search on the page (default Tridactyl keybinding) and due to docs.djangoproject.com intercepting it in a way that is impossible to override (I've tried but failed) I have to press several keys every time when I search something.

Besides, the search feature on docs.djangoproject.com is pretty much useless - I don't use it because it always returns ton of unwanted results, e.g. when you search a name of some utility function, it will return all mentions of it for all the versions of Django (3.2, 3.1, 3.0, 2.2, etc). It's way easier to just type utility_func site:docs.djangoproject.com in the search engine, or simply utility_func django rather than use built-in search.

And that inconvenient search feature binding shadows an actually useful binding...

(I just came here to see if someone already suggested to remove the annoying / binding or at least suggest a way to override it for users who find it annoying like me)

emorozov avatar Nov 17 '21 05:11 emorozov

We could consider changing the key binding, yes. "/" is "quick find" in firefox, so it's an annoying collision.

I notice that some sites e.g. Tailwind use ctrl-k/command-k, which is probably a good sign that it doesn't conflict with anything.

adamchainz avatar Nov 27 '21 20:11 adamchainz

Coincidentally, CTRL+k is a keyboard shortcut for focusing the search/address bar in both Firefox and Chrome. Maybe that's why Tailwind chose it in their docs to focus their own search prompt.

It wouldn't be too bad to chose CTRL+k because Firefox also has CTRL+j as an alternative. Chrome has CTRL+e as an alternative.

jnns avatar Mar 29 '22 08:03 jnns

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 04 '22 02:10 stale[bot]

I don't think this is stale. We only need a PR to start working on it.

pauloxnet avatar Oct 04 '22 08:10 pauloxnet

Just noticed that MDN also uses Command-K / Ctrl-K. I think we should copy this convention.

adamchainz avatar Oct 06 '22 09:10 adamchainz

Hey guys, I prepared a PR #1236 with the fix for this one, PLMK what do you think.

megaden avatar Oct 12 '22 14:10 megaden