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 in buddy list.

apoorvapendse14231e9fe2e3
diff --git a/web/src/click_handlers.ts b/web/src/click_handlers.ts
index b08ef36a9ac..2c8e826af76 100644
--- a/web/src/click_handlers.ts
+++ b/web/src/click_handlers.ts
@@ -462,6 +462,12 @@ export function initialize(): void {
if ($(e.target).parents(".user-profile-picture").length === 1) {
return;
}
+ if (document.getSelection()?.type === "Range") {
+ // To avoid the click behavior if a user name or status text is
+ // selected.
+ e.preventDefault();
+ return;
+ }
const $li = $(e.target).parents("li");
diff --git a/web/styles/right_sidebar.css b/web/styles/right_sidebar.css
index cd00c467798..d30d3d88fb3 100644
--- a/web/styles/right_sidebar.css
+++ b/web/styles/right_sidebar.css
@@ -356,6 +356,7 @@
}
.user-presence-link {
+ user-select: text;
grid-area: row-content;
&:hover,
diff --git a/web/templates/presence_row.hbs b/web/templates/presence_row.hbs
index 2d4ed1a9502..908d623ba19 100644
--- a/web/templates/presence_row.hbs
+++ b/web/templates/presence_row.hbs
@@ -2,7 +2,7 @@
<div class="selectable_sidebar_block">
{{#if user_list_style.WITH_STATUS}}
<span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span>
- <a class="user-presence-link" href="{{href}}">
+ <a class="user-presence-link" href="{{href}}" draggable="false">
<div class="user-name-and-status-wrapper">
<div class="user-name-and-status-emoji">
{{> user_full_name .}}
@@ -18,7 +18,7 @@
<span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span>
</div>
</div>
- <a class="user-presence-link" href="{{href}}">
+ <a class="user-presence-link" href="{{href}}" draggable="false">
<div class="user-name-and-status-wrapper">
<div class="user-name-and-status-emoji">
{{> user_full_name .}}
@@ -29,7 +29,7 @@
</a>
{{else}}
<span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span>
- <a class="user-presence-link" href="{{href}}">
+ <a class="user-presence-link" href="{{href}}" draggable="false">
<div class="user-name-and-status-emoji">
{{> user_full_name .}}
{{> status_emoji status_emoji_info}}