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

When writing a message in the web DM view, pressing enter for IME conversion causes it to be sent. #4178

Closed
ryoppippi opened this issue May 22, 2024 · 0 comments · Fixed by #4186
Labels
bug Something isn't working

Comments

@ryoppippi
Copy link

ryoppippi commented May 22, 2024

Describe the bug

When writing a message in the web DM view, pressing enter for IME conversion causes it to be sent.

To Reproduce

Steps to reproduce the behavior:

  1. Open the production DM view.
  2. Writing text with Japanese IME
  3. Type some word and hit enter for select word
  4. Accidentally message is sent...

Expected behavior

Do not send text while typing

Screenshots

default.mov

Details

  • Platform: mac safari 17.4.1
  • Platform version:
  • App version:

Additional context
I checked this implementation

const onKeyDown = React.useCallback(
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
// Don't submit the form when the Japanese or any other IME is composing
if (isComposing.current) return
if (e.key === 'Enter') {
if (e.shiftKey) return
e.preventDefault()
onSubmit()
}
},
[onSubmit, isComposing],
)
const onChange = React.useCallback(
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
setMessage(e.target.value)
},
[],
)

I think this is caused by the execution order of onKeyDown and onCompositionEnd

@ryoppippi ryoppippi added the bug Something isn't working label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant