What happens
Persons who write Korean, Chinese or Japanese use an input method editor (IME). The IME uses the Enter key to confirm the characters that it composed. qui listens for the Enter key on text fields and submits immediately. The submit can occur before the composed text is in the field. The person then saves an empty or an incomplete value.
Why it happens
The key handlers test only e.key === "Enter". They do not test if the IME is still composing. The browser sets isComposing to true on the key event during composition.
How to correct it
Add the composition test to each Enter handler that is on a text field:
if (e.key === "Enter" && !e.nativeEvent.isComposing) {
Where to correct it
isComposing is not used in web/src today. There are 27 Enter handlers in 15 files. Find them with this command:
grep -rn 'key === "Enter"' web/src --include="*.tsx"
Correct only the handlers on text fields. Do not correct the handlers that start a role="button" element with Enter or Space, because they are not text entry. These are examples of handlers to leave as they are: components/search/SearchResultCard.tsx:87, components/ui/multi-select.tsx:117 and pages/Search.tsx:155.
How it was found
CodeRabbit found this condition in PR #2193, on components/torrents/FilterViewsSection.tsx. That PR did not cause the condition. Thus the correction is made here, for all the applicable sites.
How to test it
Set the input source of the operating system to Korean or to Chinese. Type a name in a dialog. Push Enter to confirm the characters. The dialog must stay open. Push Enter again. The dialog must then submit.
What happens
Persons who write Korean, Chinese or Japanese use an input method editor (IME). The IME uses the Enter key to confirm the characters that it composed. qui listens for the Enter key on text fields and submits immediately. The submit can occur before the composed text is in the field. The person then saves an empty or an incomplete value.
Why it happens
The key handlers test only
e.key === "Enter". They do not test if the IME is still composing. The browser setsisComposingto true on the key event during composition.How to correct it
Add the composition test to each Enter handler that is on a text field:
Where to correct it
isComposingis not used inweb/srctoday. There are 27 Enter handlers in 15 files. Find them with this command:Correct only the handlers on text fields. Do not correct the handlers that start a
role="button"element with Enter or Space, because they are not text entry. These are examples of handlers to leave as they are:components/search/SearchResultCard.tsx:87,components/ui/multi-select.tsx:117andpages/Search.tsx:155.How it was found
CodeRabbit found this condition in PR #2193, on
components/torrents/FilterViewsSection.tsx. That PR did not cause the condition. Thus the correction is made here, for all the applicable sites.How to test it
Set the input source of the operating system to Korean or to Chinese. Type a name in a dialog. Push Enter to confirm the characters. The dialog must stay open. Push Enter again. The dialog must then submit.