Skip to content

same-page-links - Apply to linked PR links#9195

Merged
SunsetTechuila merged 4 commits into
refined-github:mainfrom
CalvinMagezi:fix/same-page-links-closing-links
Apr 15, 2026
Merged

same-page-links - Apply to linked PR links#9195
SunsetTechuila merged 4 commits into
refined-github:mainfrom
CalvinMagezi:fix/same-page-links-closing-links

Conversation

@CalvinMagezi

@CalvinMagezi CalvinMagezi commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #9187

Updates the feature to cover:

  • linked PR links on issue lists
  • linked PR links in issue sticky header
  • linked PR links in the menu in issue header
  • linked PR and release links on issue sidebar

Test URLs

Fixes refined-github#9187

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the bug label Apr 12, 2026
@CalvinMagezi

Copy link
Copy Markdown
Contributor Author

I tested this in Chrome without the extension installed. In that environment, the linked PR indicators on the issue list render as <button> elements (not <a>), so I couldn't directly reproduce the target="_blank" behavior described in the issue.

The selector I used targets [data-testid="list-row-linked-pull-requests"] a[target="_blank"], which should match if those elements render as anchor tags with target="_blank" when the extension is installed or in Safari.

Could you confirm whether the linked PR elements on the issue list actually render as <a target="_blank"> in your environment? Happy to adjust the selector if the DOM structure is different.

@fregante fregante added enhancement and removed bug labels Apr 12, 2026
@fregante

Copy link
Copy Markdown
Member

I can't believe we didn't support this already. Changed to be an enhancement

fregante
fregante previously approved these changes Apr 12, 2026
Comment thread source/features/same-page-links.tsx Outdated

function initIssueList(signal: AbortSignal): void {
observe(
'[data-testid="list-row-linked-pull-requests"] a[target="_blank"]', // Closing links on the issue list

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this selector only works on issue lists. PR lists also have links pointing to issues. Can you verify whether the bug exists there and whether a new selector needs to be added here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cases where an issue has multiple closing PRs, there's a popup. The selector should cover the links inside the popup as well (assuming they open in a new tab)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(assuming they open in a new tab)

They don't

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR lists also have links pointing to issues

No

Comment thread source/features/same-page-links.tsx Outdated
@SunsetTechuila SunsetTechuila changed the title same-page-links - Support closing links on issue list same-page-links - Support linked issue/PR links Apr 13, 2026
@fregante fregante dismissed their stale review April 14, 2026 06:40

More to do

@SunsetTechuila SunsetTechuila changed the title same-page-links - Support linked issue/PR links same-page-links - Support linked PR links Apr 15, 2026
@SunsetTechuila SunsetTechuila changed the title same-page-links - Support linked PR links same-page-links - Update feature Apr 15, 2026
function init(signal: AbortSignal): void {
observe([
'[data-testid="state-reason-link"] + [target="_blank"]', // "Closing issue" link
'[data-testid="issue-metadata-fixed"] [target="_blank"]', // Reference PR link in issue header

@SunsetTechuila SunsetTechuila Apr 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't handle links in sticky header

@SunsetTechuila

Copy link
Copy Markdown
Contributor

Off-topic suggestion: it would make sense to disable this feature on mobile, since it's harder to open links in a new tab there

Comment thread source/features/same-page-links.tsx Outdated
Comment thread package.json
"flat-zip": "^1.0.1",
"github-reserved-names": "^2.1.1",
"github-url-detection": "^11.1.3",
"github-url-detection": "^11.2.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

affects #9060

@SunsetTechuila SunsetTechuila merged commit d11c14e into refined-github:main Apr 15, 2026
9 checks passed
@fregante

Copy link
Copy Markdown
Member

Off-topic suggestion: it would make sense to disable this feature on mobile, since it's harder to open links in a new tab there

The feature follows the logic that it's up to the user to decide where links open and that it's "surprising behavior" to do otherwise. The only reasonable exception is to avoid loss of data (e.g. avoid navigation specifically when filling out a form)

Mobile doesn't change this

@fregante

fregante commented Apr 16, 2026

Copy link
Copy Markdown
Member

PR lists also have links pointing to issues

No

No what? It's here:

Screenshot 1

It doesn't open in a new tab though. It's worth leaving a comment among the selectors to point this out.

(assuming they open in a new tab)

They don't

Goes to show how these target=_blank are applied without rhyme or reason.

@fregante fregante changed the title same-page-links - Update feature same-page-links - Extend feature to more links Apr 20, 2026
@fregante fregante changed the title same-page-links - Extend feature to more links same-page-links - Apply to linked PR links Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

same-page-links support "closing links" on issue list

3 participants