Skip to content

bug(mat-tree): renderNodeChanges sets all tabindices to "-1" #32779

@aHereitani

Description

@aHereitani

Is this a regression?

  • Yes, this behavior used to work in the previous version

Description

Using CdkTree.renderNodeChanges (or reassigning CdkTree.dataSource) leads to all tabindices of mat-tree-node being set to "-1", making them unavailable for keyboard navigation.

Reproduction

StackBlitz link:
Steps to reproduce:

  1. visit https://stackblitz.com/edit/sqa8lvn4
  2. hit "rerender" button

Expected Behavior

First node has tabindex="0" in order to be reachable by tabbing.

Actual Behavior

All nodes are removed from taborder.

Environment

  • Angular: 21
  • CDK/Material: 21
  • Browser(s): tested in Chrome and Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): tested on Windows

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/tree

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions