Skip to content

Commit bbcb8d0

Browse files
committed
fix(material/tree): refactor again
refactored isExpanded function again Fixes #21922
1 parent 4de31b5 commit bbcb8d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cdk/tree/tree.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export class CdkTree<T, K = T> implements AfterContentChecked, CollectionViewer,
321321
exportAs: 'cdkTreeNode',
322322
host: {
323323
'class': 'cdk-tree-node',
324-
'[attr.aria-expanded]': 'isLeafNode ? null : isExpanded',
324+
'[attr.aria-expanded]': 'isExpanded',
325325
},
326326
standalone: true,
327327
})
@@ -388,7 +388,10 @@ export class CdkTreeNode<T, K = T> implements FocusableOption, OnDestroy, OnInit
388388
return false;
389389
}
390390

391-
get isExpanded(): boolean {
391+
get isExpanded(): boolean | null {
392+
if (this.isLeafNode) {
393+
return null;
394+
}
392395
return this._tree.treeControl.isExpanded(this._data);
393396
}
394397

0 commit comments

Comments
 (0)