ndmitchell / hoogle

Haskell API search engine
http://hoogle.haskell.org/
Other
738 stars 134 forks source link

Autofocus search bar? #289

Open brprice opened 5 years ago

brprice commented 5 years ago

I tend to use the keyboard and avoid the mouse as much as possible. For this workstyle it would be helpful if the search box was autofocused (as it is on Hackage). I don't see any downsides for other users, since pretty much every use of hoogle requires filling this field in (but please correct me if I'm wrong!).

A similar idea is to improve the link hinting that Vimium does (follow links/focus text boxes via the keyboard) by adding a label to the search box. However I have no idea how this interacts with other browser extensions or users.

My HTML knowledge is pretty slim, but I think these could be accomplished by:

I haven't tested the first or made a merge request with the changes as I don't understand how to locally deploy a modified version of hoogle. An example of making the second change to the live page (using Firefox's developer tools) is: before: to select the search box one can type "19" before after: now one can also type "qu" (or "2") after

ndmitchell commented 5 years ago

Happy to use autofocus. I was doing setting the focus with script, but I guess that failed to work for you? Moving it to an attribute is better, and I've done that now. Will be deployed in about 4 hours.

Happy to take a patch for labels etc, but I guess we should also be labelling the dropdown and Search? To test locally do hoogle generate then hoogle server. You probably want to edit html/index.html to add the labels.