From 1001c0d60aa0d1adcfee7d445c107592a3a29304 Mon Sep 17 00:00:00 2001 From: apoorvapendse Date: Thu, 17 Jul 2025 09:52:27 +0530 Subject: [PATCH] left_sidebar: Improve text selection for channel names. Fixes: https://chat.zulip.org/#narrow/channel/9-issues/topic/.E2.9C.94.20.F0.9F.8E.AF.20focus.20bug.20with.20.22first.20unread.22.20channel.20click.20policy/near/2222421. Signed-off-by: apoorvapendse --- web/src/stream_list.ts | 5 +++++ web/styles/left_sidebar.css | 1 + web/templates/stream_sidebar_row.hbs | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts index 4cf0f43049..728445f8d7 100644 --- a/web/src/stream_list.ts +++ b/web/src/stream_list.ts @@ -1256,6 +1256,11 @@ export function set_event_handlers({ if (e.metaKey || e.ctrlKey || e.shiftKey) { return; } + if (document.getSelection()?.type === "Range") { + // To avoid the click behavior if a channel name is selected. + e.preventDefault(); + return; + } const stream_id = stream_id_for_elt($(e.target).parents("li.narrow-filter")); on_sidebar_channel_click(stream_id, e, show_channel_feed); diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css index ffa8fe171c..8040ca84a5 100644 --- a/web/styles/left_sidebar.css +++ b/web/styles/left_sidebar.css @@ -1549,6 +1549,7 @@ li.active-sub-filter { } .subscription_block { + user-select: text; grid-template-columns: var(--left-sidebar-toggle-width-offset) var( --left-sidebar-icon-column-width diff --git a/web/templates/stream_sidebar_row.hbs b/web/templates/stream_sidebar_row.hbs index 16ff540dfd..3c230451bd 100644 --- a/web/templates/stream_sidebar_row.hbs +++ b/web/templates/stream_sidebar_row.hbs @@ -2,7 +2,7 @@