Skip to content
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(select): do not close the dropdown after selecting when popup bind to itself #2567

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaikaibenkai
Copy link
Contributor

@kaikaibenkai kaikaibenkai commented Jul 15, 2023

Types of changes

  • New feature
  • Bug fix
  • Enhancement
  • Component style change
  • Typescript definition change
  • Documentation change
  • Coding style change
  • Refactoring
  • Test cases
  • Continuous integration
  • Breaking change
  • Others

Background and context

fix #2564

Solution

如果挂到 <a-select> 自己,会导致用户选择后触发 MouseEvent,而正常情况下不会。

观察到 MouseEventtarget 是点击的选项,所以在处理 MouseEvent 时判断 target 是否 popup 的子节点。
如果是子节点,说明点击事件发生在 popup 中,也就是点击了选项,那就应该 changeVisible(false)
如果不是子节点,说明一切正常。

How is the change tested?

see #2564

Changelog

Component Changelog(CN) Changelog(EN) Related issues
select 修复 popup-container 绑定到自己时选择后不隐藏的 bug fix the bug of not close the dropdown after selecting when popup bind to itself Close #2564

Checklist:

  • Test suite passes (npm run test)
  • Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
  • Changes are submitted to the appropriate branch (e.g. features should be submitted to feature branch and others
    should be submitted to main branch)

@kaikaibenkai
Copy link
Contributor Author

kaikaibenkai commented Jul 15, 2023

功能测试通过
20230715172131_rec_

但是由于 HTMLElement#contains 方法耗时较长, trigger 性能下降了

是否需要考虑一下给 trigger 加个 enable-child-verify props,手动开启这个 patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

select组件无法自动关闭下拉框
1 participant