Skip to content

bug(cdk/tree): cdkTreeNodeToggle not focusable with keyboard since v18 #31193

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

Open
1 task done
jbuiquan opened this issue May 22, 2025 · 0 comments
Open
1 task done
Labels
needs triage This issue needs to be triaged by the team

Comments

@jbuiquan
Copy link

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

I migrated the CDK from version 17 to 18.
Since then, on a nested tree, I can't navigate with keyboard on tree item buttons with cdkTreeNodeToggle directive as tabindex=-1 has been added.
In term of accessibility, it's impossible to use the tree with keyboard.

Am i missing something ?

In the cdk documentation it can't be done either (see stackblitz forked from the documentation).

Reproduction

StackBlitz link: https://stackblitz.com/edit/yyzovrer-bnm3z1wu
Steps to reproduce:

  1. Navigate with keyboard in the preview section
  2. Try to focus on a tree item and toggle it with Enter or Space

Expected Behavior

I expect to be able to navigate with keyboard on the tree items and toggle with Enter or Space to expand/collapse its content.

Actual Behavior

When navigating with tab i only focus on the first element then i need to use arrow keys.
When focusing an item pressing Enter or Space doesn't do anything.

Environment

  • Angular: 18.2
  • CDK/Material: 18.2.14
  • Browser(s): Firefox/Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu
@jbuiquan jbuiquan added the needs triage This issue needs to be triaged by the team label May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

1 participant