-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit e97d4b1
fix(cdk/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 2d79ab7 commit e97d4b1
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 | |
---|---|---|---|
| |||
93 | 93 |
| |
94 | 94 |
| |
95 | 95 |
| |
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | ||
100 | + | ||
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | ||
105 | + | ||
106 | + | ||
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 | + | ||
96 | 132 |
| |
97 | 133 |
| |
98 | 134 |
| |
|
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 |
| |
| |||
349 | 351 |
| |
350 | 352 |
| |
351 | 353 |
| |
352 | - | ||
354 | + | ||
353 | 355 |
| |
354 | 356 |
| |
355 | 357 |
| |
|
0 commit comments