From d512e9a7c9b71d4e0a2b86aaa3feafe6190ec74c Mon Sep 17 00:00:00 2001 From: apoorvapendse Date: Thu, 16 Oct 2025 18:02:38 +0530 Subject: [PATCH] mobile_web: Persist text selection on longtap. This change enables mobile web users to select text from messages which lets them do standard text selection stuff like copy, select + quote, etc. Previously, this was not possible as long tapping text content resulted in triggering the reply action behavior, which included removal of all selection ranges caused by longtaps. The possible drawback is not being able long tap a message in a narrow to reply to the associated topic/dm. As an alternative, that can be achieved by a short tap on the message and then tapping the composebox. Fixes: https://chat.zulip.org/#narrow/channel/9-issues/topic/Cannot.20select.20text.20in.20mobile.20web/with/2277387 Frontend discussion: https://chat.zulip.org/#narrow/channel/6-frontend/topic/Simulating.20text.20selection.20on.20Chrome.20DevTools.20for.20mobile.2E/with/2278441 Design discussion: https://chat.zulip.org/#narrow/channel/101-design/topic/Text.20selection.20UX.20on.20mobile.20web/with/2278584 Signed-off-by: apoorvapendse --- web/src/click_handlers.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/web/src/click_handlers.ts b/web/src/click_handlers.ts index 104d5c2f87..53ee6721ad 100644 --- a/web/src/click_handlers.ts +++ b/web/src/click_handlers.ts @@ -220,22 +220,6 @@ export function initialize(): void { // selection function which will open the compose box and select the message. if (!util.is_mobile()) { $("#main_div").on("click", ".messagebox", select_message_function); - // on the other hand, on mobile it should be done with a long tap. - } else { - $("#main_div").on("longtap", ".messagebox", function (this: HTMLElement, e) { - const sel = window.getSelection(); - // if one matches, remove the current selections. - // after a longtap that is valid, there should be no text selected. - if (sel) { - if (sel.removeAllRanges) { - sel.removeAllRanges(); - } else if (sel.empty) { - sel.empty(); - } - } - - select_message_function.call(this, e); - }); } $("#main_div").on("click", ".star_container", function (e) {