Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
Firstly, I would like to express my appreciation for your work on the cmdk library. As a frequent user of the library, it has greatly aided me in my projects, and I'm truly grateful for your contributions to the community.
However, I have discovered a bug in the cmdk library related to IME (Input Method Editor) conversion, which is crucial for inputting non-Latin based languages, such as Japanese. This bug significantly affects the user experience for those who use these languages, as it interferes with the normal operation of the library.
Here's the issue:
I am using cmdk to create a multi-select component that allows for the creation of new items. The user enters any characters to create a new tag and confirms it by pressing Enter. However, when the user presses Enter to finalize the conversion of the string in an IME, Command's item selection is inadvertently triggered. This results in an unintended user experience. Please refer to the following link for more details:
Screen.Recording.2023-08-03.at.13.00.30.mov
To solve this issue, I propose adding a conditional check if (!e.isComposing) {} within the 'Enter' key handling logic. The e.isComposing property of the KeyboardEvent interface is set to true while the user is in the middle of an IME composition session. By checking if e.isComposing is false, we ensure that the code block will only execute after the IME composition is completed, thereby preventing the premature triggering of item selection.
This modification will not affect users who do not utilize IME conversion tools, yet it will significantly improve the library's usability for those who do.