-
Notifications
You must be signed in to change notification settings - Fork 4.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: Fix unexpected block insertion during IME composition #45510
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Size Change: -1 B (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
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.
Looks good
@ellatrix I think this issue should also be checked for other components refactored into |
Thank you @t-hamano for investigating and working on a fix!
That's definitely a possibility — would you actually have time to investigate those components, since you are very familiar with the issue and how to reproduce it? Thank you! 🙏 |
@ciampo |
@t-hamano Thank you so much for flagging! I'll also add Modal to the list of confirmed affected components — if there's some kind of text input in the modal and somebody hits Esc to escape out of IME composition, the modal will close. Could you fix that too, if you're addressing them all together? 🙏 I fear that this will become a common pitfall as people start switching from 📌 In short: When listening to key events that potentially fire from text inputs, |
Oh, it wasn't just the Enter key that should be considered. I would like to address them as well 👍 |
Fix: #45496
Please refer to the issue for details and causes of this problem.
What?
This PR fixes a problem in inserting a block using the slash key, where the Enter key to confirm input causes an unexpected block to be inserted.
Why?
Details are given in the issue comments, but for example, in Japanese, we press the Enter key after selecting a character from the candidates to confirm the input.
In #43432,
event.keyCode
was replaced byevent.code
. But I confirmedevent.code
detects the Enter key to confirm the input, resulting in the unintended insertion of a block.How?
I found that
event.key
is valid: any keystroke before the input is confirmed, including the Enter key, returns the stringProcess
.Testing Instructions
This PR may be difficult to test because it requires Japanese input, see "Step-by-step reproduction instructions" in #45496.