diff --git a/frontend/app/element/menu.less b/frontend/app/element/menu.less index 60397f7f0..12b3e1c6b 100644 --- a/frontend/app/element/menu.less +++ b/frontend/app/element/menu.less @@ -1,6 +1,5 @@ .menu { position: absolute; - z-index: 1000; display: flex; max-width: 400px; padding: 2px; diff --git a/frontend/app/element/menu.tsx b/frontend/app/element/menu.tsx index 9c762c436..d8aff3273 100644 --- a/frontend/app/element/menu.tsx +++ b/frontend/app/element/menu.tsx @@ -1,7 +1,7 @@ // Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { type Placement, useDismiss, useFloating, useInteractions } from "@floating-ui/react"; +import { FloatingPortal, type Placement, useDismiss, useFloating, useInteractions } from "@floating-ui/react"; import clsx from "clsx"; import { createRef, Fragment, memo, ReactNode, useRef, useState } from "react"; import ReactDOM from "react-dom"; @@ -141,53 +141,55 @@ const MenuComponent = memo( {isOpen && ( -
- {items.map((item, index) => { - const key = `${index}`; - const isActive = hoveredItems.includes(key); + +
+ {items.map((item, index) => { + const key = `${index}`; + const isActive = hoveredItems.includes(key); - const menuItemProps = { - className: clsx("menu-item", { active: isActive }), - onMouseEnter: (event: React.MouseEvent) => - handleMouseEnterItem(event, null, index, item), - onClick: (e: React.MouseEvent) => handleOnClick(e, item), - }; + const menuItemProps = { + className: clsx("menu-item", { active: isActive }), + onMouseEnter: (event: React.MouseEvent) => + handleMouseEnterItem(event, null, index, item), + onClick: (e: React.MouseEvent) => handleOnClick(e, item), + }; - const renderedItem = renderMenuItem ? ( - renderMenuItem(item, menuItemProps) - ) : ( -
- {item.label} - {item.subItems && } -
- ); + const renderedItem = renderMenuItem ? ( + renderMenuItem(item, menuItemProps) + ) : ( +
+ {item.label} + {item.subItems && } +
+ ); - return ( - - {renderedItem} - {visibleSubMenus[key]?.visible && item.subItems && ( - - )} - - ); - })} -
+ return ( + + {renderedItem} + {visibleSubMenus[key]?.visible && item.subItems && ( + + )} + + ); + })} +
+ )} );