From ae7da31aa4d457b4023293536ae14ab6a7d9f511 Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Mon, 7 Feb 2022 23:29:06 -0500 Subject: [PATCH 1/2] fix(input): cursor position does not jump to end --- core/src/components/input/input.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/components/input/input.tsx b/core/src/components/input/input.tsx index 28121cf27f3..405d8dd8e41 100644 --- a/core/src/components/input/input.tsx +++ b/core/src/components/input/input.tsx @@ -240,7 +240,10 @@ export class Input implements ComponentInterface { * Used for patterns such as input trimming (removing whitespace), * or input masking. */ - this.nativeInput.value = this.getValue(); + const { selectionStart, selectionEnd } = this.nativeInput; + this.nativeInput.value = this.getValue(); + // Set the cursor position back to where it was before the value change + this.nativeInput.setSelectionRange(selectionStart, selectionEnd); } this.emitStyle(); this.ionChange.emit({ value: this.value == null ? this.value : this.value.toString() }); From c992f7df17849da5dd79fbe37714fe2f8db8d676 Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Tue, 8 Feb 2022 10:50:23 -0500 Subject: [PATCH 2/2] chore(): add tech debt task for iOS 15.3 patch --- core/src/components/input/input.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/components/input/input.tsx b/core/src/components/input/input.tsx index 405d8dd8e41..e31ad2a0f4f 100644 --- a/core/src/components/input/input.tsx +++ b/core/src/components/input/input.tsx @@ -242,6 +242,7 @@ export class Input implements ComponentInterface { */ const { selectionStart, selectionEnd } = this.nativeInput; this.nativeInput.value = this.getValue(); + // TODO: FW-727 Remove this when we drop support for iOS 15.3 // Set the cursor position back to where it was before the value change this.nativeInput.setSelectionRange(selectionStart, selectionEnd); }