Skip to content

AutoComplete 输入一个字符光标会自动消失/丢失focus #8085

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

Open
1 task done
jasonren0403 opened this issue Mar 20, 2025 · 3 comments
Open
1 task done

AutoComplete 输入一个字符光标会自动消失/丢失focus #8085

jasonren0403 opened this issue Mar 20, 2025 · 3 comments

Comments

@jasonren0403
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

vue: 3.5.13

Reproduction link

https://jasonren0403.github.io/antdv-autocomplete-placeholder-toolong/

Steps to reproduce

直达Pages

还是在之前那个autocomplete复现仓库中,在name2中输入opt,会正常弹出选项,输入3也会正常显示选项,且可以继续输入;在name1和collapse组件中的auto-complete的输入无论是111(选项有此字符串)还是333(选项无此字符串)都无法正常完成输入

What is expected?

即使没有任何匹配的选项,光标也不至于跳出auto-complete组件

What is actually happening?

输入完一个字符,该组件就失焦了,导致无法正常完成输入

@wangqian0628
Copy link

发现了具体的规律:
AutoComplete设置allowClear后输入第一个字符在filterOption中返回false未命中时会自动清除input导致无法继续输入,删除allowClear后正常。

@jasonren0403
Copy link
Contributor Author

发现了具体的规律: AutoComplete设置allowClear后输入第一个字符在filterOption中返回false未命中时会自动清除input导致无法继续输入,删除allowClear后正常。

和 allowClear 有关么,我这个没有设置 allowClear 也会有这个问题

@wangqian0628
Copy link

发现了具体的规律: AutoComplete设置allowClear后输入第一个字符在filterOption中返回false未命中时会自动清除input导致无法继续输入,删除allowClear后正常。

和 allowClear 有关么,我这个没有设置 allowClear 也会有这个问题

我测试是有100%的关系,删除allowClear属性就好了,加上就不行,一直闪烁并清除文本框,没办法继续输入了

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

No branches or pull requests

2 participants