Explorar el Código

fix: prevent submission during text composition in SearchTypeahead

Shun Miyazawa hace 10 meses
padre
commit
5929c761c9
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  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]);
   }, [onChange, onInputChange]);
 
 
   const keyDownHandler = useCallback((event: KeyboardEvent) => {
   const keyDownHandler = useCallback((event: KeyboardEvent) => {
+    if (event.nativeEvent.isComposing) {
+      // do nothing while composing
+      return;
+    }
+
     if (event.key === 'Enter') {
     if (event.key === 'Enter') {
       if (onSubmit != null && input != null && input.length > 0) {
       if (onSubmit != null && input != null && input.length > 0) {
         // schedule to submit with 100ms delay
         // schedule to submit with 100ms delay