@@ -94,6 +94,9 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
9494 /** Used to reference correct document/window */
9595 protected _document ?: Document ;
9696
97+ /** Class that should be applied to the textarea while it's being measured. */
98+ private _measuringClass : string ;
99+
97100 constructor ( private _elementRef : ElementRef < HTMLElement > ,
98101 private _platform : Platform ,
99102 private _ngZone : NgZone ,
@@ -102,6 +105,9 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
102105 this . _document = document ;
103106
104107 this . _textareaElement = this . _elementRef . nativeElement as HTMLTextAreaElement ;
108+ this . _measuringClass = _platform . FIREFOX ?
109+ 'cdk-textarea-autosize-measuring-firefox' :
110+ 'cdk-textarea-autosize-measuring' ;
105111 }
106112
107113 /** Sets the minimum height of the textarea as determined by minRows. */
@@ -229,16 +235,16 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
229235 // Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight
230236 // value. To ensure that the scrollHeight is not bigger than the content, the placeholders
231237 // need to be removed temporarily.
232- textarea . classList . add ( 'cdk-textarea-autosize-measuring' ) ;
238+ textarea . classList . add ( this . _measuringClass ) ;
233239 textarea . placeholder = '' ;
234240
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).
237243 const height = textarea . scrollHeight - 4 ;
238244
239245 // Use the scrollHeight to know how large the textarea *would* be if fit its entire value.
240246 textarea . style . height = `${ height } px` ;
241- textarea . classList . remove ( 'cdk-textarea-autosize-measuring' ) ;
247+ textarea . classList . remove ( this . _measuringClass ) ;
242248 textarea . placeholder = placeholderText ;
243249
244250 this . _ngZone . runOutsideAngular ( ( ) => {
0 commit comments