components icon indicating copy to clipboard operation
components copied to clipboard

bug(Tree): Mat Nested Tree node autofocus

Open danPwiz opened this issue 1 year ago • 0 comments
trafficstars

Is this a regression?

  • [X] 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

danPwiz avatar Aug 22 '24 20:08 danPwiz