File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -337,8 +337,7 @@ export class CdkTreeNode<T> implements FocusableOption, OnDestroy {
337
337
}
338
338
339
339
/**
340
- * The role of the node should be 'group' if it's an internal node,
341
- * and 'treeitem' if it's a leaf node.
340
+ * The role of the node should always be 'treeitem'.
342
341
*/
343
342
@Input ( ) role : 'treeitem' | 'group' = 'treeitem' ;
344
343
@@ -366,7 +365,7 @@ export class CdkTreeNode<T> implements FocusableOption, OnDestroy {
366
365
367
366
protected _setRoleFromData ( ) : void {
368
367
if ( this . _tree . treeControl . isExpandable ) {
369
- this . role = this . _tree . treeControl . isExpandable ( this . _data ) ? 'group' : 'treeitem' ;
368
+ this . role = 'treeitem' ;
370
369
} else {
371
370
if ( ! this . _tree . treeControl . getChildren ) {
372
371
throw getTreeControlFunctionsMissingError ( ) ;
@@ -382,6 +381,6 @@ export class CdkTreeNode<T> implements FocusableOption, OnDestroy {
382
381
}
383
382
384
383
protected _setRoleFromChildren ( children : T [ ] ) {
385
- this . role = children && children . length ? 'group' : 'treeitem' ;
384
+ this . role = 'treeitem' ;
386
385
}
387
386
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ const _MatTreeNodeMixinBase: HasTabIndexCtor & CanDisableCtor & typeof CdkTreeNo
45
45
host : {
46
46
'[attr.aria-expanded]' : 'isExpanded' ,
47
47
'[attr.aria-level]' : 'level + 1' ,
48
- '[attr.role]' : `'treeitem'` ,
48
+ '[attr.role]' : 'role' ,
49
49
'class' : 'mat-tree-node'
50
50
} ,
51
51
providers : [ { provide : CdkTreeNode , useExisting : MatTreeNode } ]
@@ -88,7 +88,7 @@ export class MatTreeNodeDef<T> extends CdkTreeNodeDef<T> {
88
88
exportAs : 'matNestedTreeNode' ,
89
89
host : {
90
90
'[attr.aria-expanded]' : 'isExpanded' ,
91
- '[attr.role]' : `'treeitem'` ,
91
+ '[attr.role]' : 'role' ,
92
92
'class' : 'mat-nested-tree-node' ,
93
93
} ,
94
94
providers : [
You can’t perform that action at this time.
0 commit comments