diff --git a/interaction-manager/package.json b/interaction-manager/package.json index 0fd75d4f..01a15e98 100644 --- a/interaction-manager/package.json +++ b/interaction-manager/package.json @@ -1,6 +1,6 @@ { "name": "coherent-gameface-interaction-manager", - "version": "2.3.1", + "version": "2.3.2", "description": "Library for the most common UI interactions", "main": "dist/interaction-manager.js", "module": "esm/interaction-manager.js", diff --git a/interaction-manager/src/lib_components/keyboard.js b/interaction-manager/src/lib_components/keyboard.js index 211ad19c..1fea0a57 100644 --- a/interaction-manager/src/lib_components/keyboard.js +++ b/interaction-manager/src/lib_components/keyboard.js @@ -81,11 +81,14 @@ class Keyboard { ), ]; - const keyCombinationIndex = IM.getKeysIndex(keys); + let keyCombinationCount = IM.getKeys(keys).length; + if (keyCombinationCount === 0) return console.error('You are trying to remove a non-existent key combination!'); - if (keyCombinationIndex === -1) return console.error('You are trying to remove a non-existent key combination!'); - - _IM.keyboardFunctions.splice(keyCombinationIndex, 1); + while (keyCombinationCount > 0) { + const keyCombinationIndex = IM.getKeysIndex(keys); + _IM.keyboardFunctions.splice(keyCombinationIndex, 1); + keyCombinationCount--; + } if (_IM.keyboardFunctions.length === 0) { document.removeEventListener('keydown', this.onKeyDown);