From 1c498e42c954fc85f1a6ba2e1b4f7ae7087b79f9 Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Sun, 2 May 2021 14:10:47 -0400 Subject: [PATCH] Remove selectionchange event introduced in https://github.com/hodgef/react-simple-keyboard/issues/1140. Fixes #1007 --- src/lib/components/Keyboard.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/components/Keyboard.ts b/src/lib/components/Keyboard.ts index bd594988..3d087a3a 100644 --- a/src/lib/components/Keyboard.ts +++ b/src/lib/components/Keyboard.ts @@ -1008,7 +1008,6 @@ class SimpleKeyboard { document.addEventListener("mouseup", this.handleMouseUp); document.addEventListener("touchend", this.handleTouchEnd); document.addEventListener("select", this.handleSelect); - document.addEventListener("selectionchange", this.handleSelect); } } @@ -1104,6 +1103,10 @@ class SimpleKeyboard { * If we toggled off disableCaretPositioning, we must ensure caretPosition doesn't persist once reactivated. */ instance.setCaretPosition(null); + + if (instance.options.debug) { + console.log(`Caret position reset due to "${event?.type}" event`, event); + } } }); } @@ -1136,7 +1139,6 @@ class SimpleKeyboard { document.removeEventListener("mouseup", this.handleMouseUp); document.removeEventListener("touchend", this.handleTouchEnd); document.removeEventListener("select", this.handleSelect); - document.removeEventListener("selectionchange", this.handleSelect); document.onpointerup = null; document.ontouchend = null; document.ontouchcancel = null;