From ab01079f40ddf8e07ee736b343d3da562ac4fdf3 Mon Sep 17 00:00:00 2001 From: apoorvapendse Date: Wed, 25 Jun 2025 12:26:30 +0530 Subject: [PATCH] message_header: Improve text selection. Fixes: #34959. --- web/src/click_handlers.ts | 6 ++++++ web/styles/message_header.css | 12 ++++++++++++ web/templates/recipient_row.hbs | 3 +++ 3 files changed, 21 insertions(+) diff --git a/web/src/click_handlers.ts b/web/src/click_handlers.ts index 2c8e826af7..65141a4cb5 100644 --- a/web/src/click_handlers.ts +++ b/web/src/click_handlers.ts @@ -427,6 +427,9 @@ export function initialize(): void { return; } e.preventDefault(); + if (document.getSelection()?.type === "Range") { + return; + } const row_id = get_row_id_for_narrowing(this); // TODO: Navigate user according to `web_channel_default_view` setting. // Also, update the tooltip hotkey in recipient bar. @@ -439,6 +442,9 @@ export function initialize(): void { return; } e.preventDefault(); + if (document.getSelection()?.type === "Range") { + return; + } const row_id = get_row_id_for_narrowing(this); message_view.narrow_by_topic(row_id, {trigger: "message header"}); }); diff --git a/web/styles/message_header.css b/web/styles/message_header.css index 7c0343f512..259e8cd382 100644 --- a/web/styles/message_header.css +++ b/web/styles/message_header.css @@ -31,6 +31,7 @@ 1px -5px 0 0 var(--color-background); & .message_label_clickable { + user-select: text; color: var(--color-text-message-header); &:hover { @@ -39,6 +40,11 @@ } } + & .message_label_clickable:focus { + outline: none; + text-decoration: none; + } + .stream_topic_separator { line-height: 0; color: var(--color-message-header-icon-non-interactive); @@ -119,6 +125,7 @@ } .message_label_clickable { + user-select: text; display: flex; padding: 5px 0 5px 10px; font-weight: 600; @@ -131,6 +138,11 @@ text-decoration: none; } + &:focus { + outline: none; + text-decoration: none; + } + .private_message_header_icon { font-size: 1.0714em; /* 15px at 14px em */ position: relative; diff --git a/web/templates/recipient_row.hbs b/web/templates/recipient_row.hbs index 6394ef2fe5..f89878082a 100644 --- a/web/templates/recipient_row.hbs +++ b/web/templates/recipient_row.hbs @@ -4,6 +4,7 @@ {{! stream link }} {{> stream_privacy .}} @@ -26,6 +27,7 @@ {{! topic link }} {{#if (and use_match_properties (not is_empty_string_topic))}} @@ -96,6 +98,7 @@