Skip to content

Commit

Permalink
fix: reset keys on window blur
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 18, 2022
1 parent 55db756 commit 112519f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/histoire/src/client/app/util/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ window.addEventListener('keyup', event => {
})
})

window.addEventListener('blur', () => {
pressedKeys.clear()
for (const i in modifiers) {
const mod = modifiers[i]
mod.pressed = false
}
})

function isMatchingShortcut (shortcut: KeyboardShortcut): boolean {
for (const combination of shortcut) {
if (isMatchingCombination(combination.toLowerCase())) {
Expand Down

0 comments on commit 112519f

Please sign in to comment.