Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

left_sidebar: Improve text selection for dm box.

apoorvapendse0bc1bdda868c
diff --git a/web/src/pm_list.ts b/web/src/pm_list.ts
index 7ea66d57b73..a716245ecf2 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 ff695de620c..ffa8fe171c9 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 2e29a081094..d55cc2125b4 100644
--- a/web/templates/pm_list_item.hbs
+++ b/web/templates/pm_list_item.hbs
@@ -1,5 +1,5 @@
<li class="{{#if is_active}}active-sub-filter{{/if}} {{#if is_zero}}zero-dm-unreads{{/if}} dm-list-item bottom_left_row" data-user-ids-string="{{user_ids_string}}">
- <a href="{{url}}" class="dm-box dm-user-status" data-user-ids-string="{{user_ids_string}}" data-is-group="{{is_group}}">
+ <a href="{{url}}" draggable="false" class="dm-box dm-user-status" data-user-ids-string="{{user_ids_string}}" data-is-group="{{is_group}}">
{{#if is_group}}
<span class="conversation-partners-icon zulip-icon zulip-icon-dm-groups-3"></span>