Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(Popup): Invalid reference.

Hristo Terezov6187bb928a10
diff --git a/react/features/base/popover/components/Popover.web.tsx b/react/features/base/popover/components/Popover.web.tsx
index c51abd8960..03b660dcaa 100644
--- a/react/features/base/popover/components/Popover.web.tsx
+++ b/react/features/base/popover/components/Popover.web.tsx
@@ -282,7 +282,7 @@ class Popover extends Component<IProps, IState> {
// Use the `enabled` prop instead of conditionally rendering ReactFocusOn
// to prevent UI stutter on dialog appearance. It seems the focus guards generated annoy
// our DialogPortal positioning calculations.
- enabled = { this.state.enableFocusLock }
+ enabled = { Boolean(this._contextMenuRef) && this.state.enableFocusLock }
returnFocus = {
// If we return the focus to an element outside the viewport the page will scroll to
@@ -294,7 +294,7 @@ class Popover extends Component<IProps, IState> {
// large video.
isElementInTheViewport
}
- shards = { [ this._contextMenuRef ] }>
+ shards = { this._contextMenuRef && [ this._contextMenuRef ] }>
{this._renderContent()}
</FocusOn>
</DialogPortal>
@@ -325,7 +325,9 @@ class Popover extends Component<IProps, IState> {
* @returns {void}
*/
_setContextMenuRef(elem: HTMLElement) {
- this._contextMenuRef = elem;
+ if (!elem || document.body.contains(elem)) {
+ this._contextMenuRef = elem;
+ }
}
/**
diff --git a/react/features/toolbox/components/web/DialogPortal.ts b/react/features/toolbox/components/web/DialogPortal.ts
index ba4ff31832..21cad3f0ce 100644
--- a/react/features/toolbox/components/web/DialogPortal.ts
+++ b/react/features/toolbox/components/web/DialogPortal.ts
@@ -79,7 +79,7 @@ function DialogPortal({ children, className, style, getRef, setSize, targetSelec
getRef(portalTarget);
portalTarget.style.zIndex = `${ZINDEX_DIALOG_PORTAL}`;
}
- }, [ portalTarget ]);
+ }, [ portalTarget, getRef ]);
useEffect(() => {
const size = {