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(Popup): Invalid reference. #13497

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions react/features/base/popover/components/Popover.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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>
Expand Down Expand Up @@ -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;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion react/features/toolbox/components/web/DialogPortal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down