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 channel names.

apoorvapendse1001c0d60aa0
diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts
index 4cf0f43049b..728445f8d77 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 ffa8fe171c9..8040ca84a57 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 16ff540dfd1..3c230451bd6 100644
--- a/web/templates/stream_sidebar_row.hbs
+++ b/web/templates/stream_sidebar_row.hbs
@@ -2,7 +2,7 @@
<li class="narrow-filter{{#if is_muted}} out_of_home_view{{/if}}" data-stream-id="{{id}}">
<div class="bottom_left_row">
- <a href="{{url}}" class="subscription_block selectable_sidebar_block">
+ <a href="{{url}}" class="subscription_block selectable_sidebar_block" draggable="false">
<span class="stream-privacy-original-color-{{id}} stream-privacy filter-icon" style="color: {{color}}">
{{> stream_privacy . }}