Skip to content

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented May 14, 2019

修复比较恶心,Select 本身不管 Menu 里的状态,如果要判断是否当前有 active 的选项需要扒 Menu 的 mini-store 里的值。
为了不要这么耦合,折中选取 combobox 模式下且 defaultActive 为 false 时,按了 enter 后自动关闭 popup,以使得行为可以透传出来。

fix ant-design/ant-design#16572

@zombieJ zombieJ requested a review from afc163 May 14, 2019 13:07
@vercel
Copy link

vercel bot commented May 14, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://rc-select-git-combo-fix.react-component.now.sh

src/Select.tsx Outdated

// Hard close popup to avoid lock of non option in combobox mode
if (isRealOpen && combobox && defaultActiveFirstOption === false) {
setTimeout(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最好记得 clear 一下

@zombieJ
Copy link
Member Author

zombieJ commented May 14, 2019

Updated. Please check.

@zombieJ zombieJ merged commit 34cd0e3 into master May 14, 2019
@delete-merged-branch delete-merged-branch bot deleted the combo-fix branch May 14, 2019 17:04
@afc163
Copy link
Member

afc163 commented May 15, 2019

Did this resolve ant-design/ant-design#16568 ?

@zombieJ
Copy link
Member Author

zombieJ commented May 15, 2019

DatePicker may have better solution (refactor 😄~ )

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.

Awkward navigation of AutoComplete when defaultActiveFirstOption=false and no values are selected

2 participants