Skip to content

Commit c7256b2

Browse files
committed
fix(cdk/text-field): Long multiline textfield focus issue.
When we have long multiline textfield and put cursor on almost an end (For eg. on 3rd last line) the scroll moves up to the top of textarea. This fix will use `blur` and `focus` in `scrollToCaretPosition` method Fixes #20255
1 parent c40c701 commit c7256b2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/cdk/text-field/autosize.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
367367
// it to receive focus on IE and Edge.
368368
if (!this._destroyed.isStopped && this._hasFocus) {
369369
textarea.setSelectionRange(selectionStart, selectionEnd);
370+
textarea.blur();
371+
textarea.focus();
370372
}
371373
}
372374
}

0 commit comments

Comments
 (0)