Open
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
17.x
Description
Reopen Issue #29865. CDK/Material: 19.1.2 contains a fix #30226 but the issue still persists.
The method expandAll() of MatTree expands only the first level of a deeply nested tree. On deprecated MatTreeControl, the same method was able to expand the entire tree without problems.
WORKAROUND:
this.dataSource.forEach(node => this.tree.expandDescendants(node));
Reproduction
StackBlitz link:
- Flat nodes: https://stackblitz.com/edit/jfoxsvj4?file=src%2Fexample%2Ftree-flat-child-accessor-overview-example.ts
- Nested nodes: https://stackblitz.com/edit/r8azqcn7?file=src%2Fexample%2Ftree-nested-child-accessor-overview-example.ts
Steps to reproduce:
- Open the demos.
- The tree is partially expanded
- Edit the demo and enable the workaround on the ngAfterViewInit callback.
- The tree is now fully expanded.
Expected Behavior
MatTree's expandAll() should expand all nodes.
Actual Behavior
Only the first level nodes are expanded.
Environment
- Angular: 19.1.2
- CDK/Material: 19.1.2
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows