From b4fe3fa37b5d05ec59105efdd90bbb81cd5ce43c Mon Sep 17 00:00:00 2001 From: Karl Stolley Date: Mon, 20 Jan 2025 12:42:00 -0600 Subject: [PATCH] compose: Allow left arrow to scroll buttons. --- web/src/compose_state.ts | 9 +++++++++ web/src/hotkey.js | 3 +++ 2 files changed, 12 insertions(+) diff --git a/web/src/compose_state.ts b/web/src/compose_state.ts index 725c4929f4..090ca525fa 100644 --- a/web/src/compose_state.ts +++ b/web/src/compose_state.ts @@ -148,6 +148,15 @@ function cursor_at_start_of_whitespace_in_compose(): boolean { return message_content() === "" && cursor_position === 0; } +export function focus_in_formatting_buttons(): boolean { + const is_focused_formatting_button = + document.activeElement?.classList.contains("compose_control_button"); + if (is_focused_formatting_button) { + return true; + } + return false; +} + export function focus_in_empty_compose( consider_start_of_whitespace_message_empty = false, ): boolean { diff --git a/web/src/hotkey.js b/web/src/hotkey.js index ed64526413..ff0e75596f 100644 --- a/web/src/hotkey.js +++ b/web/src/hotkey.js @@ -936,6 +936,9 @@ export function process_hotkey(e, hotkey) { } else if (overlays.streams_open()) { stream_settings_ui.toggle_view(event_name); return true; + } else if (compose_state.focus_in_formatting_buttons()) { + // Allow left arrow to scroll the formatting buttons backward + return false; } message_edit.edit_last_sent_message();