Skip to content

Conversation

@riya-amemiya
Copy link
Contributor

@riya-amemiya riya-amemiya commented Aug 19, 2024

issue

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Currently, when typing in languages that use Input Method Editors (IMEs) such as Japanese, pressing the Enter key to confirm the IME conversion unintentionally sends the message. This occurs because the system doesn't distinguish between normal Enter key presses and those used for IME conversion confirmation.

What is the new behavior?

This PR adds an isComposing check to the keydown event handler. This prevents the message from being sent while the user is still in the process of IME composition. Here's a snippet of the modified code:

onKeyDown={(e) => {
  if (!(e.target instanceof HTMLTextAreaElement)) {
    return
  }

  if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
  // ... rest of the handler

This change ensures that the Enter key only sends the message when it's not being used for IME composition confirmation.

Additional context

This bug fix improves the user experience for those typing in languages that use IMEs, such as Japanese, Chinese, and Korean. It prevents accidental message sending during the composition process, allowing for a smoother typing experience in these languages.

Copy link
Collaborator

@gregnr gregnr left a comment

Choose a reason for hiding this comment

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

Great fix, thanks @riya-amemiya 🎉

@gregnr gregnr merged commit 659d001 into supabase-community:main Sep 20, 2024
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.

2 participants