Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (a11y): add parent node check when removing existing aria describe #19951

Merged
merged 4 commits into from
Jul 28, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cdk/a11y/aria-describer/aria-describer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ export class AriaDescriber implements OnDestroy {
// already a container on the page, but we don't have a reference to it. Clear the
// old container so we don't get duplicates. Doing this, instead of emptying the previous
// container, should be slightly faster.
if (preExistingContainer) {
preExistingContainer.parentNode!.removeChild(preExistingContainer);
if (preExistingContainer && preExistingContainer.parentNode) {
preExistingContainer.parentNode.removeChild(preExistingContainer);
Comment on lines +162 to +163
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this just be

preExistingContainer?.parentNode?.removeChild(preExistingContainer);

}

messagesContainer = this._document.createElement('div');
Expand Down