Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/SubMenu/PopupTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,18 @@ export default function PopupTrigger({
const popupPlacement = popupPlacementMap[mode];

const targetMotion = getMotion(mode, motion, defaultMotions);
const targetMotionRef = React.useRef(targetMotion);

if (mode !== 'inline') {
/**
* PopupTrigger is only used for vertical and horizontal types.
* When collapsed is unfolded, the inline animation will destroy the vertical animation.
*/
targetMotionRef.current = targetMotion;
}

const mergedMotion: CSSMotionProps = {
...targetMotion,
...targetMotionRef.current,
leavedClassName: `${prefixCls}-hidden`,
removeOnLeave: false,
motionAppear: true,
Expand Down
16 changes: 16 additions & 0 deletions tests/Menu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,22 @@ describe('Menu', () => {
rerender(genMenu({ mode: 'vertical' }));
expect(global.triggerProps.popupMotion.motionName).toEqual('bambooLight');
});

it('inline does not affect vertical motion', () => {
const genMenu = props => (
<Menu defaultMotions={defaultMotions} {...props}>
<SubMenu key="bamboo">
<MenuItem key="light" />
</SubMenu>
</Menu>
);

const { rerender } = render(genMenu({ mode: 'vertical' }));
rerender(genMenu({ mode: 'inline' }));
expect(global.triggerProps.popupMotion.motionName).toEqual(
'defaultMotion',
);
});
});

it('onMouseEnter should work', () => {
Expand Down