diff --git a/app/components/ContextMenu/MenuItem.tsx b/app/components/ContextMenu/MenuItem.tsx index 20b042b18..704e9563a 100644 --- a/app/components/ContextMenu/MenuItem.tsx +++ b/app/components/ContextMenu/MenuItem.tsx @@ -41,13 +41,10 @@ const MenuItem = ( (ev) => { if (onClick) { ev.preventDefault(); - ev.stopPropagation(); onClick(ev); } - if (hide) { - hide(); - } + hide?.(); }, [onClick, hide] ); diff --git a/app/components/ContextMenu/Template.tsx b/app/components/ContextMenu/Template.tsx index 6cdbb5320..84cb0053c 100644 --- a/app/components/ContextMenu/Template.tsx +++ b/app/components/ContextMenu/Template.tsx @@ -6,6 +6,7 @@ import { useMenuState, MenuButton, MenuItem as BaseMenuItem, + MenuStateReturn, } from "reakit/Menu"; import styled, { useTheme } from "styled-components"; import Flex from "~/components/Flex"; @@ -25,7 +26,7 @@ import MouseSafeArea from "./MouseSafeArea"; import Separator from "./Separator"; import ContextMenu from "."; -type Props = { +type Props = Omit & { actions?: (Action | MenuSeparator | MenuHeading)[]; context?: Partial; items?: TMenuItem[]; @@ -37,13 +38,15 @@ const Disclosure = styled(ExpandedIcon)` right: 8px; `; -const Submenu = React.forwardRef( +type SubMenuProps = MenuStateReturn & { + templateItems: TMenuItem[]; + parentMenuState: Omit; + title: React.ReactNode; +}; + +const SubMenu = React.forwardRef( ( - { - templateItems, - title, - ...rest - }: { templateItems: TMenuItem[]; title: React.ReactNode }, + { templateItems, title, parentMenuState, ...rest }: SubMenuProps, ref: React.LegacyRef ) => { const { t } = useTranslation(); @@ -59,7 +62,11 @@ const Submenu = React.forwardRef( )} - +