diff --git a/src/components/structures/ContextMenu.js b/src/components/structures/ContextMenu.js index 4927d219b2..bc3d91a477 100644 --- a/src/components/structures/ContextMenu.js +++ b/src/components/structures/ContextMenu.js @@ -415,7 +415,7 @@ export const toRightOf = (elementRect, chevronOffset=12) => { }; // Placement method for to position context menu right-aligned and flowing to the left of elementRect -export const aboveLeft = (elementRect, chevronFace="none") => { +export const aboveLeftOf = (elementRect, chevronFace="none") => { const menuOptions = { chevronFace }; const buttonRight = elementRect.right + window.pageXOffset; diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 003103f9cb..55cb9a5487 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -35,7 +35,7 @@ import ActiveWidgetStore from '../../../stores/ActiveWidgetStore'; import classNames from 'classnames'; import {IntegrationManagers} from "../../../integrations/IntegrationManagers"; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; -import {aboveLeft, ContextMenu, ContextMenuButton} from "../../structures/ContextMenu"; +import {aboveLeftOf, ContextMenu, ContextMenuButton} from "../../structures/ContextMenu"; import PersistedElement from "./PersistedElement"; const ALLOWED_APP_URL_SCHEMES = ['https:', 'http:']; @@ -678,7 +678,7 @@ export default class AppTile extends React.Component { const WidgetContextMenu = sdk.getComponent('views.context_menus.WidgetContextMenu'); contextMenu = ( - + { - const [menuDisplayed, _button, openMenu, closeMenu] = useContextMenu(); + const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu(); useEffect(() => { onFocusChange(menuDisplayed); }, [onFocusChange, menuDisplayed]); @@ -52,8 +52,8 @@ const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFo e2eInfoCallback = onCryptoClick; } - const buttonRect = _button.current.getBoundingClientRect(); - contextMenu = + const buttonRect = button.current.getBoundingClientRect(); + contextMenu = { contextMenu } @@ -79,13 +79,13 @@ const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFo }; const ReactButton = ({mxEvent, reactions}) => { - const [menuDisplayed, _button, openMenu, closeMenu] = useContextMenu(); + const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu(); let contextMenu; if (menuDisplayed) { - const buttonRect = _button.current.getBoundingClientRect(); + const buttonRect = button.current.getBoundingClientRect(); const ReactionPicker = sdk.getComponent('emojipicker.ReactionPicker'); - contextMenu = + contextMenu = ; } @@ -96,7 +96,7 @@ const ReactButton = ({mxEvent, reactions}) => { label={_t("React")} onClick={openMenu} isExpanded={menuDisplayed} - inputRef={_button} + inputRef={button} /> { contextMenu }