Преглед изворни кода

fix: prevent submission during text composition in SearchTypeahead

Shun Miyazawa пре 10 месеци
родитељ
комит
5929c761c9
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      apps/app/src/client/components/SearchTypeahead.tsx

+ 5 - 0
apps/app/src/client/components/SearchTypeahead.tsx

@@ -147,6 +147,11 @@ const SearchTypeahead: ForwardRefRenderFunction<IFocusable, Props> = (props: Pro
   }, [onChange, onInputChange]);
 
   const keyDownHandler = useCallback((event: KeyboardEvent) => {
+    if (event.nativeEvent.isComposing) {
+      // do nothing while composing
+      return;
+    }
+
     if (event.key === 'Enter') {
       if (onSubmit != null && input != null && input.length > 0) {
         // schedule to submit with 100ms delay