From d5ba38869897f7904edf6f6f57dd1ce17eff5368 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 9 Nov 2018 13:34:01 +0100 Subject: view: inputhandler: release all keys when focus is lost --- src/view/input/inputhandler.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/view/input/inputhandler.ts b/src/view/input/inputhandler.ts index 22fdc28..17abfe6 100644 --- a/src/view/input/inputhandler.ts +++ b/src/view/input/inputhandler.ts @@ -31,6 +31,11 @@ export class InputHandler extends Listenable<[string, boolean]> { this.keys.delete(ev.code); this.runListeners(ev.code, false); }); + + window.addEventListener('blur', () => { + this.keys.clear(); + this.runListeners('', false); + }); } public has(key: string): boolean { -- cgit v1.2.3