Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(MatTree): padding is not recomputed when moving a node inside/outside an expandable node #29959

Open
1 task
poirierlouis opened this issue Nov 3, 2024 · 4 comments
Labels
area: cdk/tree area: material/tree P2 The issue is important to a large percentage of users, with a workaround

Comments

@poirierlouis
Copy link

poirierlouis commented Nov 3, 2024

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

As TreeControl is deprecated, I started migrating to the latest API using childrenAccessor. So far so good, except for one case not working any more.

I'm using matTreeNodePadding and matTreeNodePaddingIndent on <mat-tree-node>. When I move a node inside/outside of an expandable node, padding is not recomputed as-is.

Expanding/collapsing the parent node in which the node was moved, will recompute its padding though.

Reproduction

Minimal example on Stackblitz.

Steps to reproduce:

  1. Open link
  2. Open preview in a new tab
  3. Open both folders (/ and home)
  4. Follow instructions to move a node outside its parent node

dataSource is updated with a new array, using the same items. Can it be a source of error? Should the entire tree be cloned somehow, to trigger changes detection down to padding computation?

Expected Behavior

When a node is moved inside/outside of an expandable node (level is changed), padding should be recomputed based on the new level of the node.

Actual Behavior

Padding of the node is not updated when moving the node inside/outside of an expandable node.

Environment

  • Angular: 18.2.10
  • CDK/Material: 18.2.11
  • Browser(s): Firefox / Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@poirierlouis poirierlouis added the needs triage This issue needs to be triaged by the team label Nov 3, 2024
@wagnermaciel wagnermaciel added P2 The issue is important to a large percentage of users, with a workaround area: cdk/tree area: material/tree needs: clarification The issue does not contain enough information for the team to determine if it is a real bug and removed needs triage This issue needs to be triaged by the team labels Nov 7, 2024
@wagnermaciel
Copy link
Contributor

Hi @poirierlouis, would you be able to provide a stackblitz example of this issue? It is difficult to debug this only from the code & video you shared.

@poirierlouis
Copy link
Author

Hi @wagnermaciel thanks for the quick answer. Yes I'll try and write an example to reproduce this issue.

@poirierlouis
Copy link
Author

poirierlouis commented Nov 7, 2024

@wagnermaciel , I could definitely reproduce this issue, see Stackblitz example. I also updated the ticket.

@wagnermaciel wagnermaciel removed the needs: clarification The issue does not contain enough information for the team to determine if it is a real bug label Nov 8, 2024
@wagnermaciel
Copy link
Contributor

@BobobUnicorn Is this resolved by #29751?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/tree area: material/tree P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

No branches or pull requests

2 participants