Skip to content

Commit 4ff9524

Browse files
authored
fix(input): cursor position does not jump to end (#24736)
Resolves #24727
1 parent 721a461 commit 4ff9524

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/components/input/input.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ export class Input implements ComponentInterface {
240240
* Used for patterns such as input trimming (removing whitespace),
241241
* or input masking.
242242
*/
243-
this.nativeInput.value = this.getValue();
243+
const { selectionStart, selectionEnd } = this.nativeInput;
244+
this.nativeInput.value = this.getValue();
245+
// TODO: FW-727 Remove this when we drop support for iOS 15.3
246+
// Set the cursor position back to where it was before the value change
247+
this.nativeInput.setSelectionRange(selectionStart, selectionEnd);
244248
}
245249
this.emitStyle();
246250
this.ionChange.emit({ value: this.value == null ? this.value : this.value.toString() });

0 commit comments

Comments
 (0)