graphql.github.io icon indicating copy to clipboard operation
graphql.github.io copied to clipboard

Focus the search bar on "/" keypress

Open igbominadeveloper opened this issue 5 years ago • 3 comments

What does this PR do?

This PR adds functionality to the site to focus the search input when a user presses the '/' key

Background context

Because the nav bar on the site is not sticky, whenever users need to perform a site-wide search, it would require a scroll back to the top of the site page they are on and then click on the search input before they can type, now, all it takes is pressing the '/' key on the keyboard and it is focused

What are relevant issue(s)?

N/A

Screenshots

https://www.loom.com/share/71c65b520abc4f09ae61ce22dc8c7a4d

igbominadeveloper avatar May 11 '20 03:05 igbominadeveloper

Hey hey 👋🏼 FYI - The site was recently migrated to Gatsby (#938) so in order for this to be merged, you'd need to update/rebase the branch and fix the conflicts.

Also, out of curiosity, do you have any documentation on using the / key to trigger the search functionality? I'm not familiar with that practice.

carolstran avatar Nov 03 '20 00:11 carolstran

Hey hey 👋🏼 FYI - The site was recently migrated to Gatsby (#938) so in order for this to be merged, you'd need to update/rebase the branch and fix the conflicts.

Also, out of curiosity, do you have any documentation on using the / key to trigger the search functionality? I'm not familiar with that practice.

I first saw it here on github.com and laravel.com/docs @carolstran

igbominadeveloper avatar Dec 11 '20 23:12 igbominadeveloper

This would be nice addition. Cmd+K is something Docusaurus sites come with.

saihaj avatar Apr 15 '21 15:04 saihaj

@igbominadeveloper are you still aiming to implement it? if yes, can you please rebase and open a new PR? Thanks!

Urigo avatar Apr 09 '23 17:04 Urigo

@igbominadeveloper are you still aiming to implement it? if yes, can you please rebase and open a new PR? Thanks!

@Urigo Reimplemented it here

igbominadeveloper avatar Apr 18 '23 01:04 igbominadeveloper