Skip to content

Commit

Permalink
fix: Prevent Firefox from opening custom search when pressing /
Browse files Browse the repository at this point in the history
  • Loading branch information
agg23 committed May 6, 2021
1 parent 9b75852 commit 9be6f68
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/runner-ct/src/lib/useHotKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import hotkeys from 'hotkeys-js'
export const useGlobalHotKey = (shortcut: string, handler: () => void) => {
React.useEffect(() => {
// Provide a clean handler since we assert that `handler` has no args
hotkeys(shortcut, () => handler())
hotkeys(shortcut, (event) => {
handler()

event.preventDefault()
event.stopPropagation()
})

return () => hotkeys.unbind(shortcut)
}, [shortcut, handler])
Expand Down

0 comments on commit 9be6f68

Please sign in to comment.