diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx index 2570d213c6..d878e7f07f 100644 --- a/client/src/components/Chat/Input/ChatForm.tsx +++ b/client/src/components/Chat/Input/ChatForm.tsx @@ -126,6 +126,16 @@ const ChatForm = memo(({ index = 0 }: { index?: number }) => { }); const { submitMessage, submitPrompt } = useSubmitMessage(); + + const isTouchScreen = useMemo(() => window.matchMedia?.('(pointer: coarse)').matches, []); + + const onSubmit = methods.handleSubmit((data: { text: string }) => { + submitMessage(data); + if (isTouchScreen) { + textAreaRef.current?.blur(); + } + }); + const handleKeyUp = useHandleKeyUp({ index, textAreaRef, @@ -199,7 +209,7 @@ const ChatForm = memo(({ index = 0 }: { index?: number }) => { return (