@@ -55,7 +55,7 @@ export type ProgressBarMode = 'determinate' | 'indeterminate' | 'buffer' | 'quer
5555 'tabindex' : '-1' ,
5656 '[attr.aria-valuenow]' : '(mode === "indeterminate" || mode === "query") ? null : value' ,
5757 '[attr.mode]' : 'mode' ,
58- 'class' : 'mat-mdc-progress-bar' ,
58+ 'class' : 'mat-mdc-progress-bar mdc-linear-progress ' ,
5959 '[class._mat-animation-noopable]' : '_isNoopAnimation' ,
6060 } ,
6161 inputs : [ 'color' ] ,
@@ -83,22 +83,26 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
8383
8484 /** Adapter used by MDC to interact with the DOM. */
8585 private _adapter : MDCLinearProgressAdapter = {
86- addClass : ( className : string ) => this . _rootElement . classList . add ( className ) ,
87- forceLayout : ( ) => this . _rootElement . offsetWidth ,
88- removeAttribute : ( name : string ) => this . _rootElement . removeAttribute ( name ) ,
89- setAttribute : ( name : string , value : string ) => this . _rootElement . setAttribute ( name , value ) ,
90- hasClass : ( className : string ) => this . _rootElement . classList . contains ( className ) ,
91- removeClass : ( className : string ) => this . _rootElement . classList . remove ( className ) ,
86+ addClass : ( className : string ) => this . _elementRef . nativeElement . classList . add ( className ) ,
87+ forceLayout : ( ) => this . _elementRef . nativeElement . offsetWidth ,
88+ removeAttribute : ( name : string ) => this . _elementRef . nativeElement . removeAttribute ( name ) ,
89+ setAttribute : ( name : string , value : string ) => {
90+ if ( name !== 'aria-valuenow' ) {
91+ this . _elementRef . nativeElement . setAttribute ( name , value ) ;
92+ }
93+ } ,
94+ hasClass : ( className : string ) => this . _elementRef . nativeElement . classList . contains ( className ) ,
95+ removeClass : ( className : string ) => this . _elementRef . nativeElement . classList . remove ( className ) ,
9296 setPrimaryBarStyle : ( styleProperty : string , value : string ) => {
9397 ( this . _primaryBar . style as any ) [ styleProperty ] = value ;
9498 } ,
9599 setBufferBarStyle : ( styleProperty : string , value : string ) => {
96100 ( this . _bufferBar . style as any ) [ styleProperty ] = value ;
97101 } ,
98102 setStyle : ( styleProperty : string , value : string ) => {
99- ( this . _rootElement . style as any ) [ styleProperty ] = value ;
103+ ( this . _elementRef . nativeElement . style as any ) [ styleProperty ] = value ;
100104 } ,
101- getWidth : ( ) => this . _rootElement . offsetWidth ,
105+ getWidth : ( ) => this . _elementRef . nativeElement . offsetWidth ,
102106 attachResizeObserver : ( callback ) => {
103107 const resizeObserverConstructor = ( typeof window !== 'undefined' ) &&
104108 ( window as unknown as WithMDCResizeObserver ) . ResizeObserver ;
@@ -111,7 +115,7 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
111115 // on the constructed `observer`. This should not happen, but adding this check for this
112116 // edge case.
113117 if ( typeof observer . observe === 'function' ) {
114- observer . observe ( this . _rootElement ) ;
118+ observer . observe ( this . _elementRef . nativeElement ) ;
115119 return observer ;
116120 }
117121
@@ -144,7 +148,6 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
144148 }
145149 private _bufferValue = 0 ;
146150
147- private _rootElement : HTMLElement ;
148151 private _primaryBar : HTMLElement ;
149152 private _bufferBar : HTMLElement ;
150153
@@ -181,7 +184,6 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
181184 ngAfterViewInit ( ) {
182185 const element = this . _elementRef . nativeElement ;
183186
184- this . _rootElement = element . querySelector ( '.mdc-linear-progress' ) as HTMLElement ;
185187 this . _primaryBar = element . querySelector ( '.mdc-linear-progress__primary-bar' ) as HTMLElement ;
186188 this . _bufferBar = element . querySelector ( '.mdc-linear-progress__buffer-bar' ) as HTMLElement ;
187189
@@ -221,9 +223,9 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
221223
222224 const reverse = direction === 'rtl' ? mode !== 'query' : mode === 'query' ;
223225 const progressDirection = reverse ? 'rtl' : 'ltr' ;
224- const currentDirection = this . _rootElement . getAttribute ( 'dir' ) ;
226+ const currentDirection = this . _elementRef . nativeElement . getAttribute ( 'dir' ) ;
225227 if ( currentDirection !== progressDirection ) {
226- this . _rootElement . setAttribute ( 'dir' , progressDirection ) ;
228+ this . _elementRef . nativeElement . setAttribute ( 'dir' , progressDirection ) ;
227229 foundation . restartAnimation ( ) ;
228230 }
229231
0 commit comments