-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
ignore Enter on inputing with IME #6993
ignore Enter on inputing with IME #6993
Conversation
10e756d
to
b5d5b03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @chakku000!
This LGTM, but I'll also wait for @lukasmasuch to take a look as the resident expert on the st.chat_input
widget. I don't think there are any unwanted side effects that this change can cause, but just being safe.
for test sets widget value when ⌘+enter
LGTM as well 👍 It feels like there could be some corner cases that this change might break, but I couldn't find anything. But we should monitor this after release if anyone complains about the |
Thank you for your reviews |
…6993) * ignore Enter on composition for Japanese * fix incorrect indent num * write comment why uncapture Enter with isComposing * case of the lack of no nativeEvent or isComposing for test sets widget value when ⌘+enter
…6993) * ignore Enter on composition for Japanese * fix incorrect indent num * write comment why uncapture Enter with isComposing * case of the lack of no nativeEvent or isComposing for test sets widget value when ⌘+enter
…6993) * ignore Enter on composition for Japanese * fix incorrect indent num * write comment why uncapture Enter with isComposing * case of the lack of no nativeEvent or isComposing for test sets widget value when ⌘+enter
Describe your changes
When the user types Japanese or Chinese with IME, we use "Enter" not only to send but also to confirm the character conversion.
If the application captures the "composing Enter" event as send text, it's awkward, because it results in sending even though we're still inputing the words.
This seems to be a common problem. See the follow issue on React.
#6992
For example, when I want to input the sentence in Japanese "私(watashi)は(ha)人(hito)です(desu)" , I press the following keys.
"watashi<convert_key>hahito<convert_key>desu"
As a result, the first is captured, and just "私(watashi)" is sent as a message.
To solve this problem, I found the
isComposing
field in nativeEvent, and I found that ignoring theisComposing
event gave me comfortable input.https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing
GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.