Closed benknoble closed 3 weeks ago
The range-diff is probably not very useful, but I've included it here anyway (with --creation-factor=90
):
Small correction: the site uses jQuery v1.7.1 (which is almost 13 years old).
[Press s] Search entire site...
I have a slight preference for "Type [/] to search entire site..." similar to what GitHub shows in its search box:
Maybe an even better way would be to mention the shortcut less prominently, after the original placeholder text something like "Search entire site... (press `/` to focus)"
; I tried to figure out a way to use Unicode to render this as a key, but failed (it looks ugly: /⃣), and also to render the [/]
on the right-hand side (but placeholder="Search entire site...‮[/]‭"
seems not to extend to the entire search box' width).
FWIW the slash is the most common keyboard shortcut for search on websites that I know of, much more common than s (even if I have no problem keeping the functionality, I just don't want the label to say s instead of /); Not only does GitHub support it, but also YouTube, and likely others. It used to be supported in GMail, but now that I tried it, it seems that this shortcut has joined the Google Graveyard.
Other than those two small nits, I am totally in favor of this PR.
Small correction: the site uses jQuery v1.7.1 (which is almost 13 years old).
Fixed, thanks.
[Press s] Search entire site...
I have a slight preference for "Type [/] to search entire site..." similar to what GitHub shows in its search box:
GitHub cheats and uses <kbd>
markup inside a button>div>span, which I think would be hard to do with the placeholder text of an input element.
Maybe an even better way would be to mention the shortcut less prominently, after the original placeholder text something like
"Search entire site... (press `/` to focus)"
; I tried to figure out a way to use Unicode to render this as a key, but failed (it looks ugly: /⃣), and also to render the[/]
on the right-hand side (butplaceholder="Search entire site...‮[/]‭"
seems not to extend to the entire search box' width).
This is all reasonable: what do you think about an unadorned Type / to search the entire site…
? I worried that [/]
might make folks think they needed to type the keys [/]. I could also move to this to a parenthetical as suggested.
FWIW the slash is the most common keyboard shortcut for search on websites that I know of, much more common than s (even if I have no problem keeping the functionality, I just don't want the label to say s instead of /); Not only does GitHub support it, but also YouTube, and likely others. It used to be supported in GMail, but now that I tried it, it seems that this shortcut has joined the Google Graveyard.
At least for me, / still works in GMail: you have to enable keyboard shortcuts, though, IIRC.
Other than those two small nits, I am totally in favor of this PR.
❤️
Thank you so much @benknoble!
This cribs from Racket's documentation site 1, where pressing "s" will focus the search bar. This is a modified version of 2, which I choose to receive and use under the MIT license 3, 4, which is compatible with MIT-LICENSE.txt.
Add a note to the search bar's placeholder: there's a probably a better way to steer users into this, but "/" is common thanks to Vim and many websites; "s" is natural (at least to me, having used Racket's docs so long).
The jQuery features may be using deprecated handlers 5, but the site appears to be on 12-year old jQuery 6. Modifications to the jQuery code from Racket work better on Firefox and allow other document elements to intercept the event.
I haven't yet managed to setup a local version to test this; feedback from testers welcome.