From 2e20230cf7b0ff8cd4cc113aace35219d82e16c4 Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Mon, 15 Apr 2019 10:40:26 -0400 Subject: [PATCH] Reset caret position on clearInput, replaceInput --- package.json | 2 +- src/lib/components/Keyboard.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 447ca13e..727d0130 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-keyboard", - "version": "2.20.5", + "version": "2.20.6", "description": "On-screen Javascript Virtual Keyboard", "main": "build/index.js", "types": "build/index.d.ts", diff --git a/src/lib/components/Keyboard.js b/src/lib/components/Keyboard.js index 791d91af..a2c3bf8a 100644 --- a/src/lib/components/Keyboard.js +++ b/src/lib/components/Keyboard.js @@ -307,6 +307,11 @@ class SimpleKeyboard { inputName = inputName || this.options.inputName; this.input[inputName] = ""; + /** + * Reset caretPosition + */ + this.caretPosition = 0; + /** * Enforce syncInstanceInputs, if set */ @@ -349,6 +354,11 @@ class SimpleKeyboard { */ replaceInput(inputObj) { this.input = inputObj; + + /** + * Reset caretPosition + */ + this.caretPosition = null; } /**