spacedrive
spacedrive copied to clipboard
Focus search bar on press Super+K
Implements focus on search bar when super+k is pressed. Hides the key combo hint when search bar is focused.
Closes #326
@RockBacon9922 is attempting to deploy a commit to the Spacedrive Team on Vercel.
A member of the Team first needs to authorize it.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
spacedrive-landing | ✅ Ready (Inspect) | Visit Preview | Jul 17, 2022 at 0:40AM (UTC) |
spacedrive-storybook | ✅ Ready (Inspect) | Visit Preview | Jul 17, 2022 at 0:40AM (UTC) |
spacedrive-web | ✅ Ready (Inspect) | Visit Preview | Jul 17, 2022 at 0:40AM (UTC) |
IMO Super+K
is the wrong keybind for the search bar. It's usually used to access an app's command pallete, which Spacedrive doesn't have yet. Instead I propose two other options:
-
Super+L
: Common keybind to access the search bar on web browsers -
/
: Common keybind to access search functions within websites. Works in GitHub, Google, YouTube, Linear and many other sites. I think this is the best one.
Also, I don't think it should be done in Rust. These keybinds are used by many applications, only detecting them when the app is focused is a pretty standard expectation. To go further and hijack them would be irresponsible.
IMO
Super+K
is the wrong keybind for the search bar. It's usually used to access an app's command pallete, which Spacedrive doesn't have yet. Instead I propose two other options:
Super+L
: Common keybind to access the search bar on web browsers/
: Common keybind to access search functions within websites. Works in GitHub, Google, YouTube, Linear and many other sites. I think this is the best one.Also, I don't think it should be done in Rust. These keybinds are used by many applications, only detecting them when the app is focused is a pretty standard expectation. To go further and hijack them would be irresponsible.
Ok I will happily make these changes if @maxichrome and or @Brendonovich is happy with this proposition. EDIT: Forgive me I meant @jamiepine
Happy to merge this, we will however most likely replace this code as soon as a keybind system is in place. Ideally we'd want a universal way to register and override keybinds rather than directly calling document.addEventListener
in components.
Edit: Ahh, it looks like the search bar was moved to its own component, which is a merge conflict I can't resolve on GitHub, so in order for this to be merged you'll need to pull main in again and move your code into the SearchBar component.
I'll resolve merge conflicts for this PR and make some necessary changes to the feature's working and should have this mergeable shortly
The way the keyboard shortcut was implemented it would preventing typing "/" anywhere in the app.
I fixed that, updated the keyboard shortcut hint on the search box and also made it so pressing Esc
will unfocus the current input anywhere in the app. I also enabled Cmd+A
for copy all because that's been bugging me a lot.