mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(aria-describer): server-side rendering error during cleanup (#8903)
Fixes a potential server-side rendering error when the `AriaDescriber` is being cleaned up. Fixes #8901.
This commit is contained in:
committed by
Andrew Seguin
parent
a4c042b6c9
commit
8a3b19ea92
@@ -138,7 +138,6 @@ export class AriaDescriber {
|
||||
/** Creates the global container for all aria-describedby messages. */
|
||||
private _createMessagesContainer() {
|
||||
messagesContainer = this._document.createElement('div');
|
||||
|
||||
messagesContainer.setAttribute('id', MESSAGES_CONTAINER_ID);
|
||||
messagesContainer.setAttribute('aria-hidden', 'true');
|
||||
messagesContainer.style.display = 'none';
|
||||
@@ -147,8 +146,10 @@ export class AriaDescriber {
|
||||
|
||||
/** Deletes the global messages container. */
|
||||
private _deleteMessagesContainer() {
|
||||
this._document.body.removeChild(messagesContainer!);
|
||||
messagesContainer = null;
|
||||
if (messagesContainer && messagesContainer.parentNode) {
|
||||
messagesContainer.parentNode.removeChild(messagesContainer);
|
||||
messagesContainer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes all cdk-describedby messages that are hosted through the element. */
|
||||
|
||||
Reference in New Issue
Block a user