diff --git a/apps/client/src/stylesheets/theme-next/base.css b/apps/client/src/stylesheets/theme-next/base.css index b0027bd9d..45ea5a3eb 100644 --- a/apps/client/src/stylesheets/theme-next/base.css +++ b/apps/client/src/stylesheets/theme-next/base.css @@ -308,6 +308,10 @@ body.mobile #context-menu-cover { &.show { background: rgba(0, 0, 0, 0.7); } + + &.global-menu-cover { + bottom: 54px; + } } body.mobile .dropdown-menu { diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsx index c8c353b9c..12cd870eb 100644 --- a/apps/client/src/widgets/buttons/global_menu.tsx +++ b/apps/client/src/widgets/buttons/global_menu.tsx @@ -26,6 +26,7 @@ export default function GlobalMenu({ isHorizontalLayout }: { isHorizontalLayout: const isVerticalLayout = !isHorizontalLayout; const parentComponent = useContext(ParentComponent); const { isUpdateAvailable, latestVersion } = useTriliumUpdateStatus(); + const isMobileLocal = isMobile(); return ( } } noDropdownListStyle + onShown={isMobileLocal ? () => document.getElementById("context-menu-cover")?.classList.add("show", "global-menu-cover") : undefined} + onHidden={isMobileLocal ? () => document.getElementById("context-menu-cover")?.classList.remove("show", "global-menu-cover") : undefined} > diff --git a/apps/client/src/widgets/react/Dropdown.tsx b/apps/client/src/widgets/react/Dropdown.tsx index 866a138b8..3ea79bc6c 100644 --- a/apps/client/src/widgets/react/Dropdown.tsx +++ b/apps/client/src/widgets/react/Dropdown.tsx @@ -19,9 +19,11 @@ export interface DropdownProps extends Pick, "id" | "c disabled?: boolean; text?: ComponentChildren; forceShown?: boolean; + onShown?: () => void; + onHidden?: () => void; } -export default function Dropdown({ id, className, buttonClassName, isStatic, children, title, text, dropdownContainerStyle, dropdownContainerClassName, hideToggleArrow, iconAction, disabled, noSelectButtonStyle, noDropdownListStyle, forceShown }: DropdownProps) { +export default function Dropdown({ id, className, buttonClassName, isStatic, children, title, text, dropdownContainerStyle, dropdownContainerClassName, hideToggleArrow, iconAction, disabled, noSelectButtonStyle, noDropdownListStyle, forceShown, onShown: externalOnShown, onHidden: externalOnHidden }: DropdownProps) { const dropdownRef = useRef(null); const triggerRef = useRef(null); @@ -40,10 +42,12 @@ export default function Dropdown({ id, className, buttonClassName, isStatic, chi const onShown = useCallback(() => { setShown(true); + externalOnShown?.(); }, []) const onHidden = useCallback(() => { setShown(false); + externalOnHidden?.(); }, []); useEffect(() => {