-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add keyboard shortcut to package search and symbol search #77
Conversation
@josh-collinsworth I also added keyboard shortcut for symbol search on package page (S). Please take another look. |
@@ -104,6 +104,20 @@ export function LocalSymbolSearch( | |||
return () => document.removeEventListener("click", outsideClick); | |||
}, []); | |||
|
|||
useEffect(() => { | |||
const keyboardHandler = (e: KeyboardEvent) => { | |||
if (e.key === "S") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't see this before but I don't think it's probably a good idea. There's lots of reasons a user might type S
on a page. (Not least of which, in the package search in the header; if a user tries to type a capital S anywhere on the page, they'll be jumped to the search box.)
I think maybe we should just leave this one alone for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good catch. Changed the shortcut to Cmd + / and Ctrl + /. Let me know if that's better
Package search shortcut: "Cmd + K" on Mac, "Ctrl + K" on Windows and Linux
Symbol search shortcut: "Cmd + /" on Mac, "Ctrl + /" on Windows and Linux.
Closes #30