We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d91996f commit 3382bb1Copy full SHA for 3382bb1
ecosystem/plugin-docsearch/src/client/composables/useDocsearchHotkeyListener.ts
@@ -5,10 +5,15 @@ import { useEventListener } from '@vueuse/core'
5
*/
6
export const useDocsearchHotkeyListener = (callback: () => void): void => {
7
const remove = useEventListener('keydown', (event) => {
8
- if (event.key === 'k' && (event.ctrlKey || event.metaKey)) {
9
- event.preventDefault()
10
- callback()
11
- remove()
+ const isHotKeyBind = event.key === 'k' && (event.ctrlKey || event.metaKey)
+ const isSlashKey = event.key === '/'
+
+ if (!isSlashKey && !isHotKeyBind) {
12
+ return
13
}
14
15
+ event.preventDefault()
16
+ callback()
17
+ remove()
18
})
19
0 commit comments