-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Autocomplete] Input characters are added even when the IME is unsettled with freeSolo and multiple #19435
Comments
Thanks for the issue, IME is an important concern. I don't have any objection with your proposed patch. However, if you could explore the following, we would highly appreciate it: |
I'm going to research when I have time. :) |
Thank you, it feels odd that we need to dive into the |
I'm back. This is the survey of how the Benchmarks resolve this problem. react-components ❌
UI Select (AngularUI) ❌
Ant Design ✅
🆕 rc-select (react-component/select) ✅
Blueprint 🤔
UI Fablic ❌
NEXT SURVEY if I have time...https://ej2.syncfusion.com/react/documentation/auto-complete/getting-started/?no-cache=1 Is there anything you are particularly interested in? |
@teramotodaiki Oh wow, super interesting! What do you think of this fix? |
Hmm... It's better way on real world. |
I think there are 2 ways to fix.
React wraps |
@teramotodaiki 👍 for going with 2. |
@oliviertassinari Do you mean using |
Yes, unless somebody wants to weigh into another approach, it seems to be the more reliable approach. |
I'm sorry but 1 might be better because macOS/Safari returns
The |
Thanks for not giving up and keep digging. No problem for me, I believe |
An IME (Input Method Editor) holds internal state of keys are pressed and it confirms characters when the Enter is pressed. Then the Autocomplete adds into its values because the Enter is detected. It causes input characters is left on the input element but the characters has already added.
Easy to see in GIF: https://gyazo.com/4c1c5607d5500eed6845018540e0d7c6
Current Behavior 😯
When the Enter is pressed, input characters are added into Autocomplete values.
I think there are 2 ways to get that behavior.
Expected Behavior 🤔
DON'T add characters into Autocomplete values while the IME is unsettled.
To detect IME is unsettled, I am recommending to use isComposing flag. It works fine on my environments (chrome, safari and firefox). You can try it on codesandbox.io by link below.
Steps to Reproduce 🕹
Steps:
macOS/Chrome and Safari cause this problem. Firefox does not. I didn't test other browsers.
Context 🔦
I am using an autocomplete in Japanese. The Autocomplete works almost fine but IME makes it chaos.
I resolved this problem by below code, but I think also it helps community.
As far as I can see, I may be able to fix the Autocomplete behavior.
I think that inserting
&& !event.nativeEvent.isComposing
into here will be fine.https://github.com/mui-org/material-ui/blob/cbe079c4a4779778736f1c2d065158fb3d29320e/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js#L586-L606
Your Environment 🌎
The text was updated successfully, but these errors were encountered: