-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Mistaken Input Submission Due to IME Enter Key Handling and Shift+Enter Line Break Sequence. #9295
Comments
Hello, @hyasssy! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve the issue you're facing. A similar issue was previously reported and closed: Japanese IME Enter key unintentionally submits form in Workflow App. The issue was resolved by changing the form submission method to avoid triggering on key events like Dify handles key events by preventing the Enter key from sending a message if the input method is in use. The |
Thanks.
I often make a line break to organise the contents of the AI input prompt, but in that case, the above event often occurs. Debug browser: chrome, safari |
The issue you're experiencing seems to be related to the sequence of key releases when using Shift + Enter for line breaks. The current logic in Dify's To address this, you might need to adjust the key event handling logic to ensure that releasing Shift before Enter doesn't trigger a message send. This could involve adding additional checks in the Here's a potential approach:
This might require modifying the existing logic to better handle the sequence of key releases. If you need further guidance on implementing this, feel free to ask! |
I noticed that this happens not only with the Shift+Enter key, but also with all other combinations with the Enter key. |
I've read a bit of the code and it seems to me that the event on keyup is unnecessary. |
Self Checks
Dify version
0.9.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
There are times when input is mistakenly sent by pressing enter after completing IME input. When inserting a line break with shift + enter, mistaken sending occurs if you:
✔️ Expected Behavior
Nothing happens.
❌ Actual Behavior
The texts post.
If steps 2 and 3 are reversed, there is no issue.
I'm a Japanese user. I'm guessing it often happens to many user using IME.
The text was updated successfully, but these errors were encountered: