IME Composition: Enter Key Triggers Message Send Instead of Confirming Input

AI-generated summary

A bug has been reported where pressing Enter while using a Chinese IME to type English characters in the chat interface triggers message send instead of confirming the typed input without selecting IME candidates. TethysPlex explains that the IME level expects Enter to confirm raw input, but the chat application intercepts it as a send command, causing a conflict. A workaround suggested by Moin is to change the preference to send messages using Ctrl+Enter. TethysPlex also mentions a user script that partially resolves the issue. j.jaffeux notes that a fix is pending merge in a GitHub pull request (discourse/discourse#35448) and confirms that the issue doesn’t occur on google.com, suggesting the problem is specific to the chat application’s handling of IME events. The root cause lies in the application not properly distinguishing between IME composition completion and message send triggers.

There’s a bug when using a Chinese Input Method Editor (IME) to type English characters (e.g., typing words without switching the IME off). Normally, pressing Enter means “do not select any candidate and directly input the content in the buffer.” However, in the chat interface, this is interpreted as “send message,” causing this bug.

Expected Behavior:

  • User types English letters using Chinese IME (e.g., typing “hello”)
  • IME displays candidate word list
  • User presses Enter, expecting to: confirm the original typed letters without selecting any candidates

Actual Behavior:

  • Enter key is captured by the chat interface, directly triggering the “send message” function
  • This causes the IME buffer content to be incorrectly sent, or sends an incomplete message

Root Cause:

This is a keyboard shortcut conflict between two levels:

  1. IME level: Enter = confirm current input (composition)
  2. Application level: Enter = send message

The chat application is not properly handling the IME’s “composition state,” causing it to intercept the Enter key event while the IME is still processing input.


This is a video demo/repro of the bug:

Every time I press Enter key, a new message has been sent.

1 Like

An user in my community has posted an Userscript that solved this, might be helpful: https://linux.do/t/topic/670477/17

Does it help to change the preference to “send by ctrl + Enter”? Then this could be an easier workaround.

Here on Meta, you can find that at https://meta.discourse.org/my/preferences/chat

1 Like

That should fix it once merged:

https://github.com/discourse/discourse/pull/35448

Note that I tried on google.com too for example, and the first choice won’t work with enter, you need to use 1 for it to work.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.