Skip to content

bug(Tree): Mat Nested Tree node autofocus #29628

Closed
@danPwiz

Description

@danPwiz

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

18.1.5

Description

Mat nested tree node is auto focused, with no way to disable it.
In a case where the tree is below the viewport, it causes the browser to scroll to the tree.

Reproduction

StackBlitz link: https://stackblitz.com/edit/ksjuw9?file=src%2Fexample%2Ftree-nested-overview-example.ts
Steps to reproduce:

  1. Open StackBlitz
  2. Wait 1 second for the data to load.
  3. Notice that the page scrolled down to the tree component.

Expected Behavior

No autofocus, or provider a way to opt-out of the autofocus.

Actual Behavior

Tree is auto focused and there is no way to opt-out of autofocus.

Environment

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

Metadata

Metadata

Assignees

Labels

AccessibilityThis issue is related to accessibility (a11y)P2The issue is important to a large percentage of users, with a workaroundarea: cdk/tree

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions