From 0bc1bdda868cbe6af44948cfa334ae1e2c5a2163 Mon Sep 17 00:00:00 2001 From: apoorvapendse Date: Wed, 25 Jun 2025 12:24:05 +0530 Subject: [PATCH] left_sidebar: Improve text selection for dm box. Signed-off-by: apoorvapendse --- web/src/pm_list.ts | 7 +++++++ web/styles/left_sidebar.css | 2 ++ web/templates/pm_list_item.hbs | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/web/src/pm_list.ts b/web/src/pm_list.ts index 7ea66d57b7..a716245ecf 100644 --- a/web/src/pm_list.ts +++ b/web/src/pm_list.ts @@ -284,6 +284,13 @@ export function initialize(): void { zoom_in(); }); + $(".dm-list").on("click", ".dm-box", (e) => { + // To avoid the click behavior if a dm box is selected. + if (document.getSelection()?.type === "Range") { + e.preventDefault(); + } + }); + $("#left-sidebar").on("click", "#hide-more-direct-messages", (e) => { e.stopPropagation(); e.preventDefault(); diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css index ff695de620..ffa8fe171c 100644 --- a/web/styles/left_sidebar.css +++ b/web/styles/left_sidebar.css @@ -764,6 +764,7 @@ a.stream-name:focus, a.sidebar-topic-name:focus, a.conversation-partners:focus, + a.dm-box:focus, a.sidebar-topic-action-heading:focus { outline: none; text-decoration: none; @@ -2010,6 +2011,7 @@ li.topic-list-item { } .dm-box { + user-select: text; grid-template-columns: var(--left-sidebar-toggle-width-offset) [action-heading-start] var( --left-sidebar-icon-column-width diff --git a/web/templates/pm_list_item.hbs b/web/templates/pm_list_item.hbs index 2e29a08109..d55cc2125b 100644 --- a/web/templates/pm_list_item.hbs +++ b/web/templates/pm_list_item.hbs @@ -1,5 +1,5 @@
  • - + {{#if is_group}}