diff --git a/packages/react-menu/src/SubMenu.tsx b/packages/react-menu/src/SubMenu.tsx index 46a1314659..273aae38b8 100644 --- a/packages/react-menu/src/SubMenu.tsx +++ b/packages/react-menu/src/SubMenu.tsx @@ -103,6 +103,9 @@ export const SubMenu = React.forwardRef(function ( } function onEntered(node: HTMLElement) { node.style.height = 'initial'; + if (popupRef.current && popupRef.current.overlayDom) { + node.style.height = popupRef.current.overlayDom.current!.getBoundingClientRect().height + 'px'; + } } if (!collapse) { diff --git a/packages/react-overlay-trigger/src/index.tsx b/packages/react-overlay-trigger/src/index.tsx index 402c50e8f2..52899dc593 100644 --- a/packages/react-overlay-trigger/src/index.tsx +++ b/packages/react-overlay-trigger/src/index.tsx @@ -72,6 +72,7 @@ const normalizeDelay = (delay?: Delay) => (delay && typeof delay === 'object' ? export type OverlayTriggerRef = { hide: () => void; show: () => void; + overlayDom: React.MutableRefObject; }; export default React.forwardRef((props, ref) => { @@ -114,6 +115,7 @@ export default React.forwardRef((props, useImperativeHandle(ref, () => ({ hide: () => hide(), show: () => show(), + overlayDom: popupRef, })); const child: any = React.Children.only(children);