Skip to content

bug(tree): Cannot navigate in a MatTree using keyboard without TreeControl #29664

@Mikastark

Description

@Mikastark

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

Hello! 😊

After migrating from the deprecated treeControl to the new childrenAccessor input in MatTree, I noticed that keyboard navigation is no longer functioning as expected:

Arrow Key Navigation: Users can no longer navigate through the tree nodes using the arrow keys.
Toggle with Spacebar: Although the spacebar still toggles nodes, it behaves incorrectly by propagating the toggle action to parent nodes, which is not the desired behavior.
This regression is impacting the accessibility and usability of the tree component.

Reproduction

StackBlitz link: https://stackblitz.com/edit/5mkpfn-v3xvfh
Steps to reproduce:

  1. Try to use your left and arrow key after focusing the first tree : it just doesn't work
  2. Try to do the same on the second tree : it works

Expected Behavior

MatTree with childrenAccessor or levelAccessor input should works like before with TreeControl

Actual Behavior

Doesn't work when using the new childrenAccessor or levelAccessor input on MatTree but it does when a TreeControl (deprecated) is used instead

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions