From 29d7320fab03a7232a3b97ad6de31704ce468553 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 9 Jun 2026 14:56:26 +0000 Subject: [PATCH] fix(channel): focus input when pressing enter with no message selected When a channel message list was focused but the input was not, pressing enter no longer focused the input. The focus-input-on-enter hotkey was dropped in a refactor (its TOKENS.channel.focusInput token was left orphaned). Re-register an enter hotkey on the message list scope that focuses the channel input when no message is selected, while preserving the existing reply-on-enter behavior when a message is selected. --- .../channel/Channel/create-channel-hotkeys.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/js/app/packages/channel/Channel/create-channel-hotkeys.ts b/js/app/packages/channel/Channel/create-channel-hotkeys.ts index ede4ed736d..91185b652d 100644 --- a/js/app/packages/channel/Channel/create-channel-hotkeys.ts +++ b/js/app/packages/channel/Channel/create-channel-hotkeys.ts @@ -53,6 +53,10 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) { return options.messageById().get(id); }; + const focusInput = () => { + inputEl?.querySelector('[contenteditable]')?.focus(); + }; + registerHotkey({ scopeId: messageListScope, hotkey: 'arrowup', @@ -79,7 +83,7 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) { options.navigation()?.markUserIntent('down'); options.navigation()?.scrollToId(id, { align: 'nearest' }); } else { - inputEl?.querySelector('[contenteditable]')?.focus(); + focusInput(); } return true; }, @@ -112,6 +116,19 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) { }, }); + registerHotkey({ + scopeId: messageListScope, + hotkey: 'enter', + hotkeyToken: TOKENS.channel.focusInput, + description: 'Focus input', + registrationType: 'add', + condition: () => !hasSelection(), + keyDownHandler: () => { + focusInput(); + return true; + }, + }); + registerHotkey({ scopeId: messageListScope, hotkey: 'e',