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 topic text.

apoorvapendse428873403002
diff --git a/web/src/topic_list.ts b/web/src/topic_list.ts
index ba8ef0b177b..a99cba8f310 100644
--- a/web/src/topic_list.ts
+++ b/web/src/topic_list.ts
@@ -610,6 +610,11 @@ export function initialize({
return;
}
+ if (document.getSelection()?.type === "Range") {
+ // To avoid the click behavior if a topic link is selected.
+ e.preventDefault();
+ return;
+ }
const $stream_row = $(e.target).parents(".narrow-filter");
const stream_id_string = $stream_row.attr("data-stream-id");
assert(stream_id_string !== undefined);
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index 3dedd90ce70..ff695de620c 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -1654,6 +1654,10 @@ li.active-sub-filter {
}
}
+.topic-box {
+ user-select: text;
+}
+
.searching-for-more-topics {
margin-left: var(--left-sidebar-toggle-width-offset);
height: var(--line-height-sidebar-row-prominent);
diff --git a/web/templates/topic_list_item.hbs b/web/templates/topic_list_item.hbs
index 3e4b35b4d26..30d170a1f60 100644
--- a/web/templates/topic_list_item.hbs
+++ b/web/templates/topic_list_item.hbs
@@ -1,5 +1,5 @@
<li class="bottom_left_row {{#if is_active_topic}}active-sub-filter{{/if}} {{#if is_zero}}zero-topic-unreads{{/if}} {{#if is_muted}}muted_topic{{/if}} {{#if is_unmuted_or_followed}}unmuted_or_followed_topic{{/if}} topic-list-item" data-topic-name="{{topic_name}}">
- <a href="{{url}}" class="topic-box">
+ <a href="{{url}}" class="topic-box" draggable="false">
<span class="sidebar-topic-check">
{{topic_resolved_prefix}}
</span>