diff --git a/src/lib/components/Keyboard.js b/src/lib/components/Keyboard.js index 28aa155e..af3ca494 100644 --- a/src/lib/components/Keyboard.js +++ b/src/lib/components/Keyboard.js @@ -333,17 +333,19 @@ class SimpleKeyboard { */ /* istanbul ignore next */ handleButtonMouseDown(button, e) { - /** - * Handle event options - */ - if (this.options.preventMouseDownDefault) e.preventDefault(); - if (this.options.stopMouseDownPropagation) e.stopPropagation(); - - /** - * Add active class - */ - if (e) e.target.classList.add(this.activeButtonClass); + if(e){ + /** + * Handle event options + */ + if (this.options.preventMouseDownDefault) e.preventDefault(); + if (this.options.stopMouseDownPropagation) e.stopPropagation(); + /** + * Add active class + */ + e.target.classList.add(this.activeButtonClass); + } + if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout); if (this.holdTimeout) clearTimeout(this.holdTimeout);