Skip to content

bug(mat-tree): How to control a tree expansion state if treeControl is deprecated? #29856

Open
@ronlawrence3

Description

@ronlawrence3

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

No response

Description

mat-tree has [treeControl] (and many other related classes and parts) deprecated. How are we supposed to control the expansion state of the tree from our component if there is to no treeControl? Was this an oversight in documentation? even your own examples in the documentation use the deprecated features!

Reproduction

N/A

Expected Behavior

I expect deprecated features / componenets / classes to have a new replacement or documentation on HOW to use the new way of doing things that accounts for the deprecated feature.

Actual Behavior

In this case (CdkTree):

    /**
     * The tree controller
     *
     * @deprecated Use one of `levelAccessor` or `childrenAccessor` instead. To be removed in a
     * future version.
     * @breaking-change 21.0.0
     */
    treeControl?: TreeControl<T, K>;

levelAccessor and childrenAccessor have nothing to do with expansion state. Please tell us what we are supposed to use in place of treeControl!

Environment

  • Angular: 18.2.2
  • CDK/Material: 18.2.2
  • Browser(s): N/A
  • Operating System (e.g. Windows, macOS, Ubuntu): N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2The issue is important to a large percentage of users, with a workaroundarea: material/treedocsThis issue is related to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions