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.

spoiler: Fix unreliable toggle during text selection.

Rakshit Chauhan9c15d5fe568b
diff --git a/web/src/spoilers.ts b/web/src/spoilers.ts
index cd2ef154775..29bc88df806 100644
--- a/web/src/spoilers.ts
+++ b/web/src/spoilers.ts
@@ -1,5 +1,6 @@
import $ from "jquery";
+import * as mouse_drag from "./mouse_drag.ts";
import * as util from "./util.ts";
function collapse_spoiler($spoiler: JQuery): void {
@@ -64,9 +65,9 @@ export function initialize(): void {
return;
}
- // Allow selecting text inside a spoiler header.
- const selection = document.getSelection();
- if (selection?.type === "Range") {
+ // Don't toggle if the user is dragging to select text. This handles
+ // both dragging within the header and across the message body.
+ if (mouse_drag.is_drag(e)) {
return;
}