4 ms·
Concrete information on Japanese input for your list: For English input, being able to submit comments/chats with the enter key is a feature, but for Japanese
by dwg 3y ago
Concrete information on Japanese input for your list:
For English input, being able to submit comments/chats with the enter key is a feature, but for Japanese (and maybe Chinese?) users it's a bug.
In Japanese the enter key is used multiple times to select from multiple possible characters while composing a sentence—it's just how Japanese input works. If an app submits when enter is pressed, it's very difficult to finish typing even a single sentence. Often the only solution is to compose text elsewhere and then copy/paste.
There is a solution: check the keyboard event isComposing (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEve...) property (alternatively, oncompositionstart and oncompositionend) and only submit if false.
- bastawhiz 3y agoThere's a better solution: wrap your inputs in a form element and rely on the submit event rather than a keyboard event. The browser knows (or should know!) if the user intends to submit or not.
- dwg 3y agoYes, ideally let the browser handle it, and in many but not all cases that is possible.
- folmar 3y agoJust use submit type input and let the UA handle the complexity.
- Flimm 3y agoThank you for sharing this. I had no idea!