Page MenuHomePhabricator

Links in edit summaries should also open in separate tabs
Closed, ResolvedPublic3 Estimated Story Points

Description

Currently, all of the links created on Special:GlobalWatchlist have target='_blank' to ensure that they open in a separate tab. However, links within the user's edit summary, either wiki links or automatically generated section links, don't open in a separate tab.

Possible approaches:

  • in watchlistUtils try to use a regex to add target to all links as part of rawToSummary
  • in GlobalWatchlistLinker try to use a regex in fixLocalLinks
  • in SiteDisplay.js use something like $comment.find( 'a' ).attr( 'target', '_blank' ), but that doesn't solve the issue for the Vue display

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 set the point value for this task to 3.
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.

It seems that one way or the other a regex replacement is needed. Initial draft
First, remove any existing target if there is one: <a([^>]+?)\s?target=(['"]).*?\2 -> <a$1
Then, add target="_blank" before the closing >: <a([^>]+?)> -> <a$1 target="_blank">

Change #1220018 had a related patch set uploaded (by Gerrit Patch Uploader; author: IKhitron):

[mediawiki/extensions/GlobalWatchlist@master] Make comments and tag edit links open in a new browser tab.

https://gerrit.wikimedia.org/r/1220018

IKhitron raised the priority of this task from Low to High.Dec 21 2025, 6:11 PM
IKhitron moved this task from Planned to Ready to review on the User-IKhitron board.

Change #1220018 merged by jenkins-bot:

[mediawiki/extensions/GlobalWatchlist@master] Make comments and tag edit links open in a new browser tab.

https://gerrit.wikimedia.org/r/1220018

matmarex assigned this task to IKhitron.
matmarex subscribed.