From c156aea2ae212bce85ad431caf0443d7a7aea4ab Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 7 Jul 2026 01:00:35 -0500 Subject: [PATCH] refac --- .../frontend/src/lib/components/chat/ChatInput.svelte | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cptr/frontend/src/lib/components/chat/ChatInput.svelte b/cptr/frontend/src/lib/components/chat/ChatInput.svelte index 9fa9f03..d4e8d32 100644 --- a/cptr/frontend/src/lib/components/chat/ChatInput.svelte +++ b/cptr/frontend/src/lib/components/chat/ChatInput.svelte @@ -132,6 +132,13 @@ : $t('chat.voiceModeOn') ); + function isMobileInput(): boolean { + return ( + typeof window !== 'undefined' && + window.matchMedia('(hover: none) and (pointer: coarse)').matches + ); + } + // ── Lowlight setup ────────────────────────────── const lowlight = createLowlight(all); const _origHighlight = lowlight.highlight.bind(lowlight); @@ -313,6 +320,7 @@ return true; } if (event.key === 'Enter') { + if (isMobileInput()) return false; const item = currentItems[selectedIndex]; if (item && command) command(item); return true; @@ -477,6 +485,7 @@ return true; } if (event.key === 'Enter') { + if (isMobileInput()) return false; const item = currentItems[selectedIndex]; if (item && command) command(item); return true; @@ -554,6 +563,8 @@ spellcheck: 'true' }, handleKeyDown: (view, event) => { + if (event.key === 'Enter' && isMobileInput()) return false; + if (showSlashCommands) { if (event.key === 'ArrowDown') { event.preventDefault();