fix(profiles): send a builder's links to a new tab - #38
Merged
Conversation
A profile is a page of somebody else's urls. Following one replaced the profile in the same tab, so reading a builder's links meant leaving the builder behind and hitting back to get them again. The GitHub button and the user supplied links now open in a new browsing context. They already carried noopener, so nothing they open can reach back through window.opener. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6d65e362-569a-4bf7-8d7e-8201b74b14cb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Links on a builder's profile now open in a new tab.
Why
A profile is a page of somebody else's urls. Following one replaced the profile in the same tab, so reading a builder's links meant leaving the builder behind and hitting back to get them again. That is the wrong default for a page whose whole job is pointing you somewhere else.
How
Added
target="_blank"to the two outbound anchors onsrc/pages/builders/[handle].astro: the GitHub button and the user supplied links list. Both already carriednoopener, so nothing they open can reach back throughwindow.opener, and the user supplied ones keep theirnofollow ugc.Internal links, like the dev disaster rows further down the page, stay in the current tab.
Tests
New
tests/profile.links.test.mjsasserts both outbound anchors open in a new browsing context and keepnoopener, and that the user supplied ones stay untrusted. Confirmed it fails against the old markup before it passed against the new.npm test- 390 pass, 0 failastro check- 0 errors, 0 warnings, 0 hintsastro build- complete