Skip to content

Commit a6c08d5

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 3bb9338 commit a6c08d5

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
@@ -358,6 +358,8 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
358358
// it to receive focus on IE and Edge.
359359
if (!this._destroyed.isStopped && this._hasFocus) {
360360
textarea.setSelectionRange(selectionStart, selectionEnd);
361+
textarea.blur();
362+
textarea.focus();
361363
}
362364
}
363365
}

0 commit comments

Comments
 (0)