From 549fa484d59866429573e9cca0f757c3745b41b8 Mon Sep 17 00:00:00 2001 From: dm4t2 Date: Sat, 30 Oct 2021 14:29:55 +0200 Subject: [PATCH] fix: set correct caret position on focus when using `autoDecimalDigits` --- src/numberInput.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/numberInput.ts b/src/numberInput.ts index 2d12384..5ec1d99 100644 --- a/src/numberInput.ts +++ b/src/numberInput.ts @@ -232,9 +232,7 @@ export class NumberInput { this.focus = true setTimeout(() => { const { value, selectionStart, selectionEnd } = this.el - if (this.options.hideNegligibleDecimalDigitsOnFocus && value) { - this.format(value, true) - } + this.format(value, this.options.hideNegligibleDecimalDigitsOnFocus) if (selectionStart != null && selectionEnd != null && Math.abs(selectionStart - selectionEnd) > 0) { this.setCaretPosition(0, this.el.value.length) } else if (selectionStart != null) {