From aa80e354c9fd92fcb8c585cc905d9342ef11fbcc Mon Sep 17 00:00:00 2001 From: hobokenchicken Date: Thu, 2 Jul 2026 12:47:58 -0400 Subject: [PATCH] fix: Enter on dropdown executes command immediately Previously selecting a slash command with Enter just filled the input, requiring a second Enter to send. Now Enter directly executes the command transform (or opens /poll modal) and sends. --- web/src/components/ChatArea.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/web/src/components/ChatArea.tsx b/web/src/components/ChatArea.tsx index 5cc0294..e857dcf 100644 --- a/web/src/components/ChatArea.tsx +++ b/web/src/components/ChatArea.tsx @@ -783,10 +783,23 @@ export function ChatArea() { const q = commandQuery.toLowerCase(); const filtered = SLASH_COMMANDS.filter((c) => c.name.startsWith(q)).slice(0, 8); if (filtered[dropdownIndex]) { - setInput('/' + filtered[dropdownIndex].name + ' '); + const cmd = filtered[dropdownIndex]; setCommandQuery(null); setDropdownIndex(0); - inputRef.current?.focus(); + // /poll opens modal instead of sending a message + if (cmd.name === 'poll') { + setShowPollModal(true); + setInput(''); + return; + } + // ponytail: execute the command transform directly + const args = input.startsWith('/' + cmd.name + ' ') + ? input.slice(cmd.name.length + 2).trim() + : ''; + const text = cmd.transform(args, currentUser?.username || 'user'); + sendMessage(activeChannelId!, text, replyToMessage?.id); + setInput(''); + setReplyToMessage(null); } } } else if (e.key === 'Escape') {