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

`_self` is the default, so we should treat it the same as having no value specified. This fixes navigation to links like `/my/...` in custom sidebar links.
This commit is contained in:
David Taylor 2023-07-03 16:46:40 +01:00 committed by GitHub
parent 9bbfb6e171
commit 0790e9f4f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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 ||