Open a new tab when users click on "Move to Commons"
Closed, ResolvedPublic

Description

When users click on the link "Move to Commons" on a file's wikipedia file page, they should proceed with the actual move in a new tab. This should help them not to lose context of where they come from - since the original page is still open.

Lea_WMDE created this task.Mar 16 2017, 6:20 PM
Addshore claimed this task.
Addshore added a project: User-Addshore.

Change 343838 had a related patch set uploaded (by Addshore):
[mediawiki/extensions/FileExporter] Open a new tab when users click on link

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

Addshore moved this task from Backlog to Needs Review on the User-Addshore board.Mar 21 2017, 10:11 AM
Addshore moved this task from Sprint ready to Currently in sprint on the WMDE-QWERTY-Team-Board board.

Change 343838 merged by jenkins-bot:
[mediawiki/extensions/FileExporter] Open a new tab when users click on link

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

Addshore closed this task as Resolved.
Tobi_WMDE_SW reopened this task as Open.

Seems this doesn't work yet.

So it looks like target is not supported by the code that eventually handles the list of links that we modify in the hook https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation

The links appear to be build on a skin by skin basis so this would probably mean touching every skin to allow them to handle a target here.

I'm going to poke someone to get a second opinion.

Change 362366 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/skins/Vector@master] Add target support for view_urls

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

The above patch fixes the issue for Vector.
We should decide if we want to do this & if so for which skins.

Addshore moved this task from In Progress to Needs Review on the User-Addshore board.

I think the real bug here is that Vector is not using $this->makeListItem() to render this menu and instead is generating HTML by hand. I think that should support custom attributes already. (And if it doesn't, you theoretically only need to fix it in one place rather than in every skin.)

(In fact the "Export file" link correctly opens in a new tab in other skins I tested, e.g. MonoBook and Timeless.)

(In fact the "Export file" link correctly opens in a new tab in other skins I tested, e.g. MonoBook and Timeless.)

Oooh, that is nice. Thanks for looking into this!
In which case the patch that is up is the only one that we probably need (covering the main WMF usecase).
We could work on making Vector use makeListItem, or leave that to someone that knows more about the skin system.

I think the real bug here is that Vector is not using $this->makeListItem() to render this menu and instead is generating HTML by hand. I think that should support custom attributes already. (And if it doesn't, you theoretically only need to fix it in one place rather than in every skin.)

Interesting. From looking at Vector, the arbitrary attributes go to the list item. But looking at BaseTemplate, they go to the anchor link. This might complicate migration to $this->makeListItem() – but, this may just be an internal name match. I'd say it's worth trying.

Change 362366 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Add target support for view_urls

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

matmarex closed this task as Resolved.Jul 26 2017, 6:20 PM
matmarex removed a project: Patch-For-Review.

I think the real bug here is that Vector is not using $this->makeListItem() to render this menu and instead is generating HTML by hand.

I submitted https://gerrit.wikimedia.org/r/367937 to fix that.