Skip to content

A platform for community discussion. Free, open, simple.

FIX: text selection breaks opening of links in new tabs (#19867)

Aleksey Bogdanov1bc39c1a4fc4
diff --git a/app/assets/javascripts/discourse/app/lib/click-track.js b/app/assets/javascripts/discourse/app/lib/click-track.js
index 05be231b7e5..04290714033 100644
--- a/app/assets/javascripts/discourse/app/lib/click-track.js
+++ b/app/assets/javascripts/discourse/app/lib/click-track.js
@@ -5,7 +5,6 @@ import User from "discourse/models/user";
import { ajax } from "discourse/lib/ajax";
import getURL, { samePrefix } from "discourse-common/lib/get-url";
import { isTesting } from "discourse-common/config/environment";
-import { selectedText } from "discourse/lib/utilities";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import deprecated from "discourse-common/lib/deprecated";
import { getOwner } from "discourse-common/lib/get-owner";
@@ -80,14 +79,6 @@ export default {
return true;
}
- // Cancel click if triggered as part of selection.
- const selection = window.getSelection();
- if (selection.type === "Range" || selection.rangeCount > 0) {
- if (selectedText() !== "") {
- return true;
- }
- }
-
const link = e.currentTarget;
const tracking = isValidLink(link);