From df2889d416a4432980fa832ca248139158d0cd7e Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Thu, 17 Dec 2020 09:46:05 -0500 Subject: [PATCH] Address handleButtonMouseDown TypeError. Fixes #844 --- src/lib/components/Keyboard.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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);