Skip to content

Commit a2b2b9b

Browse files
authored
Revert "fix(cdk/text-field): Long multiline textfield focus issue (#30312)" (#31891)
This reverts commit dc70692. The original PR caused autosized textarea no longer auto scroll to caret position when overflow.
1 parent 667a007 commit a2b2b9b

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/cdk/text-field/autosize.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
118118
private _cachedLineHeight?: number;
119119
/** Cached height of a textarea with only the placeholder. */
120120
private _cachedPlaceholderHeight?: number;
121-
/** Cached scroll top of a textarea */
122-
private _cachedScrollTop: number;
123121

124122
/** Used to reference correct document/window */
125123
protected _document = inject(DOCUMENT);
@@ -306,7 +304,6 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
306304

307305
this._cacheTextareaLineHeight();
308306
this._cacheTextareaPlaceholderHeight();
309-
this._cachedScrollTop = this._textareaElement.scrollTop;
310307

311308
// If we haven't determined the line-height yet, we know we're still hidden and there's no point
312309
// in checking the height of the textarea.
@@ -371,7 +368,6 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
371368
// it to receive focus on IE and Edge.
372369
if (!this._destroyed.isStopped && this._hasFocus) {
373370
textarea.setSelectionRange(selectionStart, selectionEnd);
374-
textarea.scrollTop = this._cachedScrollTop;
375371
}
376372
}
377373
}

0 commit comments

Comments
 (0)