Skip to content

Commit 16a3730

Browse files
authored
fix(cdk/a11y): add parent node check to AriaDescriber (#19951)
Adds a check for `parentNode` when removing a description node in AriaDescriber. Fixes #19949
1 parent 165622e commit 16a3730

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cdk/a11y/aria-describer/aria-describer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ export class AriaDescriber implements OnDestroy {
167167
// already a container on the page, but we don't have a reference to it. Clear the
168168
// old container so we don't get duplicates. Doing this, instead of emptying the previous
169169
// container, should be slightly faster.
170-
if (preExistingContainer) {
171-
preExistingContainer.parentNode!.removeChild(preExistingContainer);
170+
if (preExistingContainer && preExistingContainer.parentNode) {
171+
preExistingContainer.parentNode.removeChild(preExistingContainer);
172172
}
173173

174174
messagesContainer = this._document.createElement('div');

0 commit comments

Comments
 (0)