From 8638442a4ce64f4f89e6430e09893cf1736de3d1 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Mon, 5 May 2025 08:37:20 -0400 Subject: [PATCH] refactor: Simplify touch-screen detection in message submission --- client/src/components/Chat/Input/ChatForm.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx index c66f82965d..f3f1e04b43 100644 --- a/client/src/components/Chat/Input/ChatForm.tsx +++ b/client/src/components/Chat/Input/ChatForm.tsx @@ -127,13 +127,9 @@ const ChatForm = memo(({ index = 0 }: { index?: number }) => { const { submitMessage, submitPrompt } = useSubmitMessage(); - // Detects if the device is a touch-screen by checking if the primary input mechanism is coarse (e.g., a finger). - const isTouchScreen = useMemo(() => window.matchMedia?.('(pointer: coarse)').matches, []); - const onSubmit = methods.handleSubmit((data: { text: string }) => { submitMessage(data); - // On touch-screen devices, blur the text area to dismiss the on-screen keyboard - if (isTouchScreen) { + if (window.matchMedia?.('(pointer: coarse)').matches) { textAreaRef.current?.blur(); } });