@@ -346,12 +346,12 @@ export class CdkTreeNode<T> implements DoCheck, FocusableOption, OnDestroy, OnIn
346
346
return this . _tree . treeControl . isExpanded ( this . _data ) ;
347
347
}
348
348
349
- set isExpanded ( _expanded : boolean ) {
350
- this . _expanded = _expanded ;
349
+ private _setExpanded ( _expanded : boolean ) {
350
+ this . _isAriaExpanded = _expanded ;
351
351
this . _elementRef . nativeElement . setAttribute ( 'aria-expanded' , `${ _expanded } ` ) ;
352
352
}
353
353
354
- protected _expanded : boolean ;
354
+ protected _isAriaExpanded : boolean ;
355
355
356
356
get level ( ) : number {
357
357
// If the treeControl has a getLevel method, use it to get the level. Otherwise read the
@@ -370,7 +370,7 @@ export class CdkTreeNode<T> implements DoCheck, FocusableOption, OnDestroy, OnIn
370
370
// TODO: move to host after View Engine deprecation
371
371
this . _elementRef . nativeElement . classList . add ( 'cdk-tree-node' ) ;
372
372
this . role = 'treeitem' ;
373
- this . isExpanded = this . isExpanded ;
373
+ this . _setExpanded ( this . isExpanded ) ;
374
374
}
375
375
376
376
ngOnInit ( ) : void {
@@ -383,8 +383,8 @@ export class CdkTreeNode<T> implements DoCheck, FocusableOption, OnDestroy, OnIn
383
383
// the node isn't aware when the state is changed.
384
384
// It is not set using a @HostBinding because they sometimes get lost with Mixin based classes.
385
385
// TODO: move to host after View Engine deprecation
386
- if ( this . isExpanded != this . _expanded ) {
387
- this . isExpanded = this . isExpanded ;
386
+ if ( this . isExpanded != this . _isAriaExpanded ) {
387
+ this . _setExpanded ( this . isExpanded ) ;
388
388
}
389
389
}
390
390
0 commit comments