Skip to content

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

FIX: Correctly intercept `<a href target="_self"` (#22077)

David Taylor0790e9f4f106
diff --git a/app/assets/javascripts/discourse/app/lib/intercept-click.js b/app/assets/javascripts/discourse/app/lib/intercept-click.js
index 0e7b33334af..fe81d6d5254 100644
--- a/app/assets/javascripts/discourse/app/lib/intercept-click.js
+++ b/app/assets/javascripts/discourse/app/lib/intercept-click.js
@@ -24,11 +24,13 @@ export default function interceptClick(e) {
const currentTarget = e.currentTarget;
const href = currentTarget.getAttribute("href");
+ const linkTarget = currentTarget.getAttribute("target");
+ const targettingOtherFrame = linkTarget && linkTarget !== "_self";
if (
!href ||
href.startsWith("#") ||
- currentTarget.getAttribute("target") ||
+ targettingOtherFrame ||
currentTarget.dataset.emberAction ||
currentTarget.dataset.autoRoute ||
currentTarget.dataset.shareUrl ||