fix(overlays): fix unhandled rejection
This commit is contained in:
parent
a768d62adc
commit
5a48e69bc7
2 changed files with 7 additions and 1 deletions
5
.changeset/silver-penguins-juggle.md
Normal file
5
.changeset/silver-penguins-juggle.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@lion/overlays': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Add a guard for content wrapper containing the content node before appending to the renderTarget. This prevents unhandled rejection.
|
||||||
|
|
@ -298,7 +298,8 @@ export class OverlayController {
|
||||||
this._renderTarget.appendChild(this.contentNode);
|
this._renderTarget.appendChild(this.contentNode);
|
||||||
} else {
|
} else {
|
||||||
const isInsideRenderTarget = this._renderTarget === this._contentWrapperNode.parentNode;
|
const isInsideRenderTarget = this._renderTarget === this._contentWrapperNode.parentNode;
|
||||||
if (!isInsideRenderTarget) {
|
const nodeContainsTarget = this._contentWrapperNode.contains(this._renderTarget);
|
||||||
|
if (!isInsideRenderTarget && !nodeContainsTarget) {
|
||||||
// contentWrapperNode becomes the direct (non projected) parent of contentNode
|
// contentWrapperNode becomes the direct (non projected) parent of contentNode
|
||||||
this._renderTarget.appendChild(this._contentWrapperNode);
|
this._renderTarget.appendChild(this._contentWrapperNode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue