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

Select组件 tokenSeparators 对于中文字符无法很好的支持 #28564

Closed
1 task
JesonSirius opened this issue Dec 28, 2020 · 21 comments · Fixed by react-component/select#583
Closed
1 task
Assignees
Labels
🐛 Bug Ant Design Team had proved that this is a bug. 👷🏻‍♂️ Someone working on it

Comments

@JesonSirius
Copy link

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

Reproduction link

https://codepen.io/JesonSirius/pen/YzGYXdK?editors=001

Steps to reproduce

正常输入,用中文逗号分割

What is expected?

能正常分割成tags

What is actually happening?

windows下chrome无法实现, mac下支持。

Environment Info
antd 4.9.4
React 16.7
System windows
Browser chrome
@zombieJ
Copy link
Member

zombieJ commented Dec 28, 2020

windows 下是什么表现?能来个 gif 不?

@JesonSirius
Copy link
Author

windows 下是什么表现?能来个 gif 不?

刚到单位,没带windows的电脑。。。 简单描述下,就是 按了中文的逗号 没有生成tag, 输入框里面就是 XXXX,
image

@afc163
Copy link
Member

afc163 commented Dec 28, 2020

感觉是微软输入法这个问题 #27748 (comment)

@afc163
Copy link
Member

afc163 commented Dec 28, 2020

- tokenSeparators={[',', ' ']}
+ tokenSeparators={[',', ',']}

加上中文逗号就可以了。

https://codepen.io/afc163/pen/VwKyegd?editors=001

@afc163 afc163 closed this as completed Dec 28, 2020
@JesonSirius
Copy link
Author

- tokenSeparators={[',', ' ']}
+ tokenSeparators={[',', ',']}

加上中文逗号就可以了。

https://codepen.io/afc163/pen/VwKyegd?editors=001

你又在windows下的chrome环境试过吗 ,我的还不行。。。mac上面没有任何问题。。

@afc163 afc163 reopened this Dec 28, 2020
@afc163
Copy link
Member

afc163 commented Dec 28, 2020

没测试过,我是看你的例子里没加

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

这边Windows测试正常,可以分割,@JesonSirius 你如何测试的?

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

我知道了,是输入拼音不按空格直接按逗号 @zombieJ @afc163

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

但是,Mac也一样啊,需要光标blur一下,就能分割了,但是逗号不含

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

Dec-28-2020 15-03-15

@zombieJ
Copy link
Member

zombieJ commented Dec 28, 2020

神奇,onSearch 事件里是什么能打印一下看看不?

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

拼音打字键入:nihaoa,a后面没有按空格键在预选里选择它(空格就是默认从预选里选第一个)

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

神奇,onSearch 事件里是什么能打印一下看看不?

并不是Windows特有,mac看就行。

image

@JesonSirius
Copy link
Author

其实我定位到了问题,但实在想不通原理。 在rc-select组件里面 ,generate.js 文件454行,triggerSearch方法。
image 每次触发方法, isCompositing都是false,但唯独 windows下 chrome里面,中文输入法, 按逗号,isCompositing始终为true,就很奇怪

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

是我的操作方法有什么不一样吗?我这里实验的是没有平台的区别。

@JesonSirius
Copy link
Author

是我的操作方法有什么不一样吗?我这里实验的是没有平台的区别。

我的问题,demo里面忘记加中文逗号了。。。。 现在加了, mac下正常 ,windows不行

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

我也加了的,两个系统下表现和gif一样

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

说说你按键顺序

@JesonSirius
Copy link
Author

说说你的案件顺序
切到中文输入法,随便打两个字,然后按逗号。 在汉字已经打出来的情况下 按逗号

img.mov

@zombieJ
Copy link
Member

zombieJ commented Dec 28, 2020

我试了一下搜狗输入法,输入拼音后直接按逗号然后继续输入再回车就可以重现出来:
截屏2020-12-28 下午3 47 38

@zombieJ zombieJ added the 🐛 Bug Ant Design Team had proved that this is a bug. label Dec 28, 2020
@zombieJ zombieJ self-assigned this Dec 28, 2020
@yoyo837
Copy link
Contributor

yoyo837 commented Dec 28, 2020

@zombieJ 可是他的录屏是先打好字,再按逗号,看不出啥问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug. 👷🏻‍♂️ Someone working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants