-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Menu[onClick] should not be triggered by propagated onClick event #140
Conversation
修复:点击菜单项后,Menu[onClick] 被触发两次,第一次的参数与 README.md 的一致,第二次的参数为 React 的 event 对象。 |
@@ -77,7 +77,7 @@ const nestSubMenu = (<SubMenu title={<span>offset sub menu 2</span>} key="4" pop | |||
function onOpenChange(value) { | |||
console.log('onOpenChange', value); | |||
} | |||
const commonMenu = (<Menu onSelect={handleSelect} onOpenChange={onOpenChange}> | |||
const commonMenu = (<Menu onClick={handleClick} onOpenChange={onOpenChange}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
重现 bug。
}; | ||
} | ||
// In case that onClick/onMouseLeave/onMouseEnter is passed down from owner | ||
const mouseEvent = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onClick 会被透传下来,所以 disabled 时需要显式设置为空。
语雀这边先锁版本吧,感觉这个点击行为需要讨论一下。
只能在 SubMenu 里面判断 onClick 的类型解决? |
Looking |
这个 PR 要重新实现下。 |
可能有一个合理的fix, 现在出去一下,晚上继续搞 |
@benjycui 我试了下,rc-select的单测以及antD单测用这个分支跑都没问题,把这里挂掉的单测清掉我觉得就可以合了。。 |
No description provided.