Skip to content

Commit 3813a6e

Browse files
crisbetoessjay05
authored andcommitted
fix(cdk/tree): capturing focus on load (angular#29641)
The tree implements a roving tabindex which needs to have an initial item with `tabindex = 0` to work correctly. This happens by waiting for the data to be initialized in the `TreeKeyManager` and focusing the active/first item. The problem is that this ends up stealing focus on load. We didn't notice this issue in the demo app, because all the tree are `visibility: hidden` since they're inside closed `mat-expansion-panel`, but the issue is visible in the docs site. These changes resolve the issue by setting the `tabindex` without actually moving focus. Fixes angular#29628
1 parent 8b34fb7 commit 3813a6e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/material/select/select.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
(detach)="close()">
4545
<div
4646
#panel
47+
cdkFocusable
4748
role="listbox"
4849
tabindex="-1"
4950
class="mat-mdc-select-panel mdc-menu-surface mdc-menu-surface--open {{ _getPanelTheme() }}"

0 commit comments

Comments
 (0)