From d4747a8c800ffbf0d4f52aa8a0444165a2b696c9 Mon Sep 17 00:00:00 2001 From: Jesper Alf Dam Date: Fri, 16 Aug 2019 14:27:12 +0200 Subject: [PATCH] Avoid recursion in Alt check on Firefox The Firefox workaround which checks for missing Alt key events may synthesise new KeyboardEvents. On these events, checkAlt should not be recursively triggered. Otherwise, we get "too much recursion" errors whenever the Alt key is pressed. --- kasmweb/core/input/keyboard.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kasmweb/core/input/keyboard.js b/kasmweb/core/input/keyboard.js index 9dbc8d6..d9c271c 100644 --- a/kasmweb/core/input/keyboard.js +++ b/kasmweb/core/input/keyboard.js @@ -301,6 +301,9 @@ export default class Keyboard { // Firefox Alt workaround, see below _checkAlt(e) { + if (e.skipCheckAlt) { + return; + } if (e.altKey) { return; } @@ -315,6 +318,7 @@ export default class Keyboard { const event = new KeyboardEvent('keyup', { key: downList[code], code: code }); + event.skipCheckAlt = true; target.dispatchEvent(event); }); }