From d38433be1c8238b225a4474dbeb630234af8c40c Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Mon, 19 Nov 2018 09:29:49 -0500 Subject: [PATCH] Fix buttonHold issue --- src/lib/components/Keyboard.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/components/Keyboard.js b/src/lib/components/Keyboard.js index 23615a4e..917f2272 100644 --- a/src/lib/components/Keyboard.js +++ b/src/lib/components/Keyboard.js @@ -519,6 +519,10 @@ class SimpleKeyboard { caretEventHandler(event){ let targetTagName; + if(this.isMouseHold){ + this.isMouseHold = false; + } + if(event.target.tagName){ targetTagName = event.target.tagName.toLowerCase(); } @@ -767,19 +771,19 @@ class SimpleKeyboard { */ this.onRender(); - /** - * Handling mouseup - */ - if (!useTouchEvents) { - document.onmouseup = () => this.handleButtonMouseUp(); - } - if(!this.initialized){ /** * Ensures that onInit is only called once per instantiation */ this.initialized = true; + /** + * Handling mouseup + */ + if (!useTouchEvents) { + document.onmouseup = () => this.handleButtonMouseUp(); + } + /** * Calling onInit */