diff --git a/docs/examples/antd.tsx b/docs/examples/antd.tsx index f5bd0bba..0985ac21 100644 --- a/docs/examples/antd.tsx +++ b/docs/examples/antd.tsx @@ -2,7 +2,8 @@ import React from 'react'; import type { CSSMotionProps } from 'rc-motion'; -import Menu, { SubMenu, Item as MenuItem, Divider, MenuProps } from '../../src'; +import Menu, { SubMenu, Item as MenuItem, Divider } from '../../src'; +import type { MenuProps } from '../../src'; import '../../assets/index.less'; function handleClick(info) { diff --git a/docs/examples/inlineCollapsed.tsx b/docs/examples/inlineCollapsed.tsx index 8a893d26..d1216cd3 100644 --- a/docs/examples/inlineCollapsed.tsx +++ b/docs/examples/inlineCollapsed.tsx @@ -1,11 +1,12 @@ import React, { useState } from 'react'; import Menu, { SubMenu, Item } from 'rc-menu'; import './inlineCollapsed.less'; +import { inlineMotion } from './antd' const App = () => { const [collapsed, setCollapsed] = useState(false); return ( - <> +
); } diff --git a/src/Menu.tsx b/src/Menu.tsx index ef9db196..eca785e5 100644 --- a/src/Menu.tsx +++ b/src/Menu.tsx @@ -598,7 +598,9 @@ const Menu = React.forwardRef((props, ref) => { { const { prefixCls, mode, + originMode, + inlineCollapsed, openKeys, // Disabled @@ -272,6 +274,8 @@ const InternalSubMenu = (props: SubMenuProps) => { if (!overflowDisabled) { const triggerMode = triggerModeRef.current; + const canTriggerPopupVisible = originMode !== 'inline' || inlineCollapsed; + const visible = !internalPopupClose && open && mode !== 'inline' && canTriggerPopupVisible; // Still wrap with Trigger here since we need avoid react re-mount dom node // Which makes motion failed @@ -279,7 +283,7 @@ const InternalSubMenu = (props: SubMenuProps) => {