react-component / react-component/menu
The submenu cannot hide after animation end or mouse leave
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 701
- Forks
- 266
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 3
Description
source code:
import * as React from 'react';
import Menu, { SubMenu, MenuItem } from 'rc-menu';
import classNames from 'classnames';
import 'rc-menu/assets/index.css';
const horizontalMotion = {
motionName: 'rc-menu-open-slide-up',
motionAppear: true,
motionEnter: true,
motionLeave: true
};
const children = [
<MenuItem key="1">认识小新</MenuItem>,
<SubMenu key="2" title="到店体验">
<MenuItem key="2-1">2-1</MenuItem>
</SubMenu>,
<SubMenu key="3" className="submenu" title="关于我们">
<MenuItem key="3-1">企业介绍</MenuItem>
<MenuItem key="3-2">媒体中心</MenuItem>
<MenuItem key="3-3">加入我们</MenuItem>
</SubMenu>,
<SubMenu key="4" title="探索更多">
<MenuItem key="4-1">4-1</MenuItem>
</SubMenu>
];
export default class CustomMenu extends React.PureComponent {
render() {
this.config = {
triggerSubMenuAction: 'hover',
mode: 'horizontal',
defaultMotions: { horizontal: horizontalMotion }
};
return (
<Menu defaultActiveFirst {...this.config}>
{children}
</Menu>
);
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with the provided CustomMenu example and inspect the submenu hover and motion handling used by rc-menu. Verify the animation and mouse-leave paths, then confirm that the submenu hides reliably after animation completion or when the pointer leaves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100