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

fix: IME conversion bug #166

Merged

Conversation

hajimism
Copy link
Contributor

@hajimism hajimism commented Aug 3, 2023

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.

@vercel
Copy link

vercel bot commented Aug 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmdk-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2023 5:20am

Copy link
Owner

@pacocoursey pacocoursey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@pacocoursey pacocoursey merged commit 5c24283 into pacocoursey:main Aug 14, 2023
1 of 2 checks passed
Emilstromberg added a commit to Emilstromberg/cmdk-remix that referenced this pull request Oct 4, 2023
@max-prtsr
Copy link

When it'll be released?

@Sado4
Copy link

Sado4 commented Nov 6, 2023

@pacocoursey
I am wondering when this one will be released as well.

I use shadcn ui and if this is not reflected here, there will still be a bug with Japanese input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants