react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

[Bug] `<SearchField />` trigger `onSubmit` when pressing Enter is used for completing IME

Open ktabors opened this issue 1 year ago • 1 comments

Discussed in https://github.com/adobe/react-spectrum/discussions/6332

Originally posted by QzCurious May 6, 2024 Though I use IME, but I only learned that it somehow relate to how I type/construct Chinese characters. I don't know it in any technical aspect.

It's recorded from official docs here. What I'm doing is:

  1. Click on <SearchField /> and ready for typing
  2. Switch IME for typing Chinese characters
  3. Start typing some primitives to construct the words "被送出"
  4. While I type, you can tell that I'm "constructing" by the underline
  5. Whenever I'm done constructing, I press "Enter" to construct/complete the words "被送出"
  6. The bug happened

https://github.com/adobe/react-spectrum/assets/38932402/fd6505b4-10cf-44a7-8417-3d24abe79b44

I though this behavior is caused by trigger onSubmit directly by keypress on "Enter" key (Have been discussed a bit on https://github.com/adobe/react-spectrum/discussions/5774#discussioncomment-8310540).

At this point, I'd like to argue again that instead of having a custom onSubmit implementation, not interrupting browser default behavior for "Enter on an input" might be a better approach .

ktabors avatar May 20 '24 17:05 ktabors

I didn't notice you create a issue for my discussion. I think you can close it as the bug already solved by #6404.

QzCurious avatar Jun 28 '24 18:06 QzCurious