@@ -94,6 +94,9 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
94
94
/** Used to reference correct document/window */
95
95
protected _document ?: Document ;
96
96
97
+ /** Class that should be applied to the textarea while it's being measured. */
98
+ private _measuringClass : string ;
99
+
97
100
constructor ( private _elementRef : ElementRef < HTMLElement > ,
98
101
private _platform : Platform ,
99
102
private _ngZone : NgZone ,
@@ -102,6 +105,9 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
102
105
this . _document = document ;
103
106
104
107
this . _textareaElement = this . _elementRef . nativeElement as HTMLTextAreaElement ;
108
+ this . _measuringClass = _platform . FIREFOX ?
109
+ 'cdk-textarea-autosize-measuring-firefox' :
110
+ 'cdk-textarea-autosize-measuring' ;
105
111
}
106
112
107
113
/** Sets the minimum height of the textarea as determined by minRows. */
@@ -229,16 +235,16 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
229
235
// Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight
230
236
// value. To ensure that the scrollHeight is not bigger than the content, the placeholders
231
237
// need to be removed temporarily.
232
- textarea . classList . add ( 'cdk-textarea-autosize-measuring' ) ;
238
+ textarea . classList . add ( this . _measuringClass ) ;
233
239
textarea . placeholder = '' ;
234
240
235
- // The cdk-textarea-autosize- measuring class includes a 2px padding to workaround an issue with
236
- // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom).
241
+ // The measuring class includes a 2px padding to workaround an issue with Chrome,
242
+ // so we account for that extra space here by subtracting 4 (2px top + 2px bottom).
237
243
const height = textarea . scrollHeight - 4 ;
238
244
239
245
// Use the scrollHeight to know how large the textarea *would* be if fit its entire value.
240
246
textarea . style . height = `${ height } px` ;
241
- textarea . classList . remove ( 'cdk-textarea-autosize-measuring' ) ;
247
+ textarea . classList . remove ( this . _measuringClass ) ;
242
248
textarea . placeholder = placeholderText ;
243
249
244
250
this . _ngZone . runOutsideAngular ( ( ) => {
0 commit comments