-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit 1f088c1
fix(a11y): clear active item in key manager if it is removed from the list
The active item in the `ListKeyManager` gets updated on keyboard events, but if the list changes between them, we may end up in a state where it's pointing to an item that's not in the DOM anymore. This can cause something like `aria-activedescendant` to point to an invalid element.
These changes add some logic that clear the active element if it's removed from the list and there's nothing at its new index.1 parent 49de56c commit 1f088c1
File tree
2 files changed
+40
-2
lines changed- src/cdk/a11y/key-manager
2 files changed
+40
-2
lines changedLines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
108 | + | ||
109 | + | ||
110 | + | ||
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | ||
118 | + | ||
119 | + | ||
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | ||
124 | + | ||
125 | + | ||
126 | + | ||
127 | + | ||
128 | + | ||
129 | + | ||
130 | + | ||
131 | + | ||
132 | + | ||
133 | + | ||
134 | + | ||
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | ||
139 | + | ||
140 | + | ||
141 | + | ||
142 | + | ||
143 | + | ||
108 | 144 |
| |
109 | 145 |
| |
110 | 146 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
73 | - | ||
73 | + | ||
74 | + | ||
75 | + | ||
74 | 76 |
| |
75 | 77 |
| |
76 | 78 |
| |
| |||
347 | 349 |
| |
348 | 350 |
| |
349 | 351 |
| |
350 | - | ||
352 | + | ||
351 | 353 |
| |
352 | 354 |
| |
353 | 355 |
| |
|
0 commit comments