Skip to content

Commit 3c53ed8

Browse files
committed
fix(cdk/tree): misc focus management fixes
Fix miscelaneous focus management details in response to PR feedback. * omit tabindex attribute on role="tree" element * Remove TreeKeyManagerStrategy#onInitialFocus * Implement focus/unfocus pattern for TreeKeyManagerOption and use a binding to set tabindex on tree nodes * algin with https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols * Add tree-using-legacy-key-manager.spec.ts
1 parent 372f9df commit 3c53ed8

23 files changed

+494
-539
lines changed

src/cdk/a11y/key-manager/noop-tree-key-manager.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ export class NoopTreeKeyManager<T extends TreeKeyManagerItem> implements TreeKey
5050
return null;
5151
}
5252

53-
onInitialFocus() {
54-
// noop
55-
}
56-
5753
focusItem() {
5854
// noop
5955
}

src/cdk/a11y/key-manager/tree-key-manager-strategy.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export interface TreeKeyManagerItem {
3939
* Focuses the item. This should provide some indication to the user that this item is focused.
4040
*/
4141
focus(): void;
42+
43+
/**
44+
* Unfocus the item. This should remove the focus state.
45+
*/
46+
unfocus(): void;
4247
}
4348

4449
/**
@@ -100,14 +105,6 @@ export interface TreeKeyManagerStrategy<T extends TreeKeyManagerItem> {
100105
/** The currently active item. */
101106
getActiveItem(): T | null;
102107

103-
/**
104-
* Called the first time the Tree component is focused. This method will only be called once over
105-
* the lifetime of the Tree component.
106-
*
107-
* Intended to be used to focus the first item in the tree.
108-
*/
109-
onInitialFocus(): void;
110-
111108
/**
112109
* Focus the provided item by index.
113110
*

0 commit comments

Comments
 (0)