Skip to content

Commit

Permalink
fix: native keyboard shortcuts always prevented, closes #1726
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 13, 2022
1 parent 3674f29 commit a3e6faf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/app-frontend/src/util/keyboard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { onMounted, onUnmounted } from '@vue/composition-api'

type KeyboardHandler = (event: KeyboardEvent) => boolean | void | Promise<boolean | void>

function handleKeyboard (type: 'keyup' | 'keydown', cb: KeyboardHandler) {
function handler (event: KeyboardEvent) {
if (event.target instanceof HTMLElement && (
Expand All @@ -11,7 +12,7 @@ function handleKeyboard (type: 'keyup' | 'keydown', cb: KeyboardHandler) {
}

const result = cb(event)
if (!result) {
if (result === false) {
event.preventDefault()
}
}
Expand Down

0 comments on commit a3e6faf

Please sign in to comment.