diff --git a/src/lib/services/PhysicalKeyboard.js b/src/lib/services/PhysicalKeyboard.js index 40774173..75c9adc7 100644 --- a/src/lib/services/PhysicalKeyboard.js +++ b/src/lib/services/PhysicalKeyboard.js @@ -37,7 +37,7 @@ class PhysicalKeyboard { if (options.physicalKeyboardHighlightPress) { /** - * Trigger mousedown + * Trigger pointerdown */ ( buttonDOM.onpointerdown || @@ -64,7 +64,7 @@ class PhysicalKeyboard { if (options.physicalKeyboardHighlightPress) { /** - * Trigger mousedown + * Trigger pointerup */ ( buttonDOM.onpointerup || diff --git a/src/lib/services/tests/PhysicalKeyboard.test.js b/src/lib/services/tests/PhysicalKeyboard.test.js index 51edad3c..68199e06 100644 --- a/src/lib/services/tests/PhysicalKeyboard.test.js +++ b/src/lib/services/tests/PhysicalKeyboard.test.js @@ -159,6 +159,41 @@ it('PhysicalKeyboard will work with physicalKeyboardHighlightPress (touch)', () } })); + document.dispatchEvent(new KeyboardEvent('keyup', { + code: "KeyF", + key: "f", + target: { + tagName: "input" + } + })); +}); + +it('PhysicalKeyboard with physicalKeyboardHighlightPress can trigger noop', () => { + setDOM(); + + const keyboard = new Keyboard({ + physicalKeyboardHighlight: true, + physicalKeyboardHighlightPress: true, + useTouchEvents: true, + debug: true + }); + + keyboard.getButtonElement('f').onmousedown = null; + keyboard.getButtonElement('f').onpointerdown = null; + keyboard.getButtonElement('f').ontouchstart = null; + + document.dispatchEvent(new KeyboardEvent('keydown', { + code: "KeyF", + key: "f", + target: { + tagName: "input" + } + })); + + keyboard.getButtonElement('f').onmouseup = null; + keyboard.getButtonElement('f').onpointerup = null; + keyboard.getButtonElement('f').ontouchend = null; + document.dispatchEvent(new KeyboardEvent('keyup', { code: "KeyF", key: "f",