fix(overlays): guard for backdrop parent node on teardown

This commit is contained in:
Joren Broekema 2021-01-18 13:41:07 +01:00
parent 9f0691609f
commit 9352b577fa
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/overlays': patch
---
Guard backdrop node parentNode when removing the backdrop node on teardown.

View file

@ -1016,8 +1016,8 @@ export class OverlayController extends EventTargetShim {
this.__backdropNodeToBeTornDown = this.backdropNode; this.__backdropNodeToBeTornDown = this.backdropNode;
this.__backdropAnimation.then(() => { this.__backdropAnimation.then(() => {
if (this.__backdropNodeToBeTornDown) { if (this.__backdropNodeToBeTornDown && this.__backdropNodeToBeTornDown.parentNode) {
/** @type {HTMLElement} */ (this.__backdropNodeToBeTornDown.parentNode).removeChild( this.__backdropNodeToBeTornDown.parentNode.removeChild(
this.__backdropNodeToBeTornDown, this.__backdropNodeToBeTornDown,
); );
} }