Просмотр исходного кода

fix: prevent submission during text composition in SearchTypeahead

Shun Miyazawa 10 месяцев назад
Родитель
Сommit
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