Skip to content

Open the repository link in a new tab - #4

Open
FurkaanBoraa wants to merge 1 commit into
RectZones:mainfrom
FurkaanBoraa:external-link-target
Open

Open the repository link in a new tab#4
FurkaanBoraa wants to merge 1 commit into
RectZones:mainfrom
FurkaanBoraa:external-link-target

Conversation

@FurkaanBoraa

Copy link
Copy Markdown
Contributor

Small one. The header link is labelled:

github.com/RectZones ↗

The is the conventional promise that the link leaves the site — but it did not. It replaced the landing page in the same tab, so a reader who clicked it to glance at the repo lost the page they were reading and had to come back through history. The label and the behaviour disagreed; this makes the behaviour match the label.

-<a class="gh" href="https://github.com/RectZones/RectZones">github.com/RectZones ↗</a>
+<a class="gh" href="https://github.com/RectZones/RectZones"
+   target="_blank" rel="noopener">github.com/RectZones ↗</a>

Two deliberate choices

rel="noopener", but not noreferrer. noopener denies the opened page a handle on window.opener. noreferrer would additionally strip the referrer — and the referrer is exactly what makes visits show up as coming from rectzones.app in the repo's traffic panel. Modern browsers imply noopener for target="_blank" anyway; it is written out so the intent survives anyone reading the markup.

Only this link changes. The page has four other external links (the ★ View on GitHub CTA, the README link, and Source on GitHub / Rectangle in the footer). None of them carries the arrow, so none of them is currently making a promise it breaks. Changing them too would be a behaviour change with no signal to justify it, and unannounced new tabs are a real accessibility complaint (WCAG 3.2.5) — the arrow is what defuses that here.

Worth a separate decision, not assumed in this PR: the hero ★ View on GitHub CTA has the opposite argument going for it. It is the primary conversion action, and sending people off the landing page in the same tab is arguably not what you want either — but that needs its own affordance rather than a silent target="_blank". Say the word and I will open one.

Verification

Served the page and clicked the link in a real browser: the source tab stayed on the landing page instead of navigating away, which is the actual behaviour this fixes. Attributes confirmed live in the DOM (target="_blank", rel="noopener"), and the other four external links confirmed unchanged.

Note

Opened from a fork — pull only on this repo. Independent of #2 (security-policy footer link) and #3 (copy button); the three touch different parts of the file and can merge in any order.

The link is already labelled with an ↗ arrow, which is the conventional
promise that it leaves the site. It did not: it replaced the landing
page in the same tab, so a reader who clicked it to glance at the repo
lost the page they were reading.

rel="noopener" alongside, so the opened page gets no handle on
window.opener. Not noreferrer: the referrer is how GitHub's traffic
panel shows that visitors arrived from rectzones.app, and that is worth
keeping.

Only this link changes. It is the one that carries the arrow, so it is
the one whose behaviour was inconsistent with its own label; the other
external links make no such promise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant