-
-
Notifications
You must be signed in to change notification settings - Fork 460
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: remove onMouseDown to resolve popover close #613
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/select/2iqhGzNDxANvWXwWTkMMgj7JPP8o |
Codecov Report
@@ Coverage Diff @@
## master #613 +/- ##
==========================================
- Coverage 99.18% 99.17% -0.01%
==========================================
Files 20 20
Lines 977 975 -2
Branches 327 328 +1
==========================================
- Hits 969 967 -2
Misses 7 7
Partials 1 1
Continue to review full report at Codecov.
|
if (event.target !== inputRef.current && !inputMouseDown) { | ||
event.preventDefault(); | ||
} | ||
const tagCloseMouseDown = (event.target as HTMLElement).innerText === '×'; |
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.
antd 那是 svg,也有自定义的 tag
@@ -107,7 +103,6 @@ const SelectSelector: React.FC<SelectorProps> = props => { | |||
{closable && ( | |||
<TransBtn | |||
className={`${selectionPrefixCls}-item-remove`} | |||
onMouseDown={onPreventMouseDown} |
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.
@zombieJ 这个之前禁鼠标 down ,是想自定义的 tag 自己去处理鼠标事件?
这个重现好邪典…………真实场景是什么样子的,能说说不? |
真实场景,比如表格列上面的筛选面板,里面放置一个带 Modal 框的组件,用于在 Model 框内选择数据进行过滤。当 Model 框内存在 Select 组件时,就会触发这个场景了。 |
点击 tag 关闭导致 popover 关闭是来自于 |
最新已修复 |
存在场景,当 Popover 内有 Modal 框,Modal 框内存在 Select 组件,为 Tag 模式,此时点击标签的 x 号会导致 Popover 被关闭。
Demo:
https://codesandbox.io/s/congfucengneiguanbi-antd4141-forked-e1bcd?file=/index.js
此 PR 允许标签的关闭按钮冒泡到 rc-trigger 的 onPopupMouseDown:
https://github.com/react-component/trigger/blob/89eefdb148ee68e4bbfe5b5b2887ceaff6b2e42c/src/index.tsx#L386
在如下判断中生效:
https://github.com/react-component/trigger/blob/89eefdb148ee68e4bbfe5b5b2887ceaff6b2e42c/src/index.tsx#L410
修复问题。