Page MenuHomePhabricator

Exiting an image displayed via mediaviewer on wikipedia takes you back one site in browser history instead of taking you to base article
Closed, ResolvedPublic

Description

I have produced the bug with both Firefox and Chrome on my laptop.

Go to any website which is not Wikipedia, for example https://www.google.com
Go then directly to an image in Wikipedia, for example https://en.wikipedia.org/wiki/Lone_Wolf_and_Cub#/media/File:Lone_Wolf_manga.jpg
Close the image, either by ESC button or by pressing the X button.

Actual Results: It takes you back to the last website in browsing history, https://www.google.com on my example.
Expected Results: It should have taken to the base article which the image is from, https://en.wikipedia.org/wiki/Lone_Wolf_and_Cub on my example.

Event Timeline

Aklapper renamed this task from Exiting an image on wikipedia takes you back one site in history instead of returning to base article to Exiting an image on wikipedia takes you back one site in browser history instead of taking you to base article.Oct 26 2019, 10:42 AM
Peachey88 renamed this task from Exiting an image on wikipedia takes you back one site in browser history instead of taking you to base article to Exiting an image displayed via mediawiki on wikipedia takes you back one site in browser history instead of taking you to base article.Oct 26 2019, 10:52 AM
Peachey88 renamed this task from Exiting an image displayed via mediawiki on wikipedia takes you back one site in browser history instead of taking you to base article to Exiting an image displayed via mediaviewer on wikipedia takes you back one site in browser history instead of taking you to base article.

Change 560576 had a related patch set uploaded (by Aron Manning; owner: Aron Manning):
[mediawiki/extensions/MultimediaViewer@master] After closing, browser sometimes scrolls to the top of the page

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

Change 560576 had a related patch set uploaded (by Aron Manning; owner: Aron Manning):
[mediawiki/extensions/MultimediaViewer@master] Save history position before opening MMV; remove need to restore scroll position; replace javascript-positioning with static css; cleanup html and css.

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

Demian subscribed.

The submitted patch resolves this bug too.

[Resetting assignee due to inactive user account]

Aklapper triaged this task as Low priority.Jul 14 2022, 9:51 AM

Change 560576 abandoned by Ladsgroup:

[mediawiki/extensions/MultimediaViewer@master] Save history position before opening MMV; remove need to restore scroll position; replace javascript-positioning with static css; cleanup html and css.

Reason:

The author has been banned indef from our tech spaces and the patch has not been touched for really long time.

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

From T241909: Closing mediaviewer can unexpectedly close browser tab

Yes, consistently reproducible in Firefox (incl Private browsing) and Chrome (incl Incognito mode).

Firefox -> new private browsing window -> paste url in address bar and hit enter -> after it loads press "X" close button of Mediaviewer.

If this doesn't happen for you, perhaps it is specific to the macOS versions of both of these browsers.

I guess MediaViewer (or the OO.Router functionality it uses) triggers a history back-navigation when it shouldn't. History handling seems quite broken in a number of other small ways too (e.g. if you launch MediaViewer by clicking on an image, and then navigate between images, the back button doesn't behave reasonably).

IOW this seems like a duplicate of T236591, with the previous history entry being chrome://newtab or such.

Change 910522 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MultimediaViewer@master] Allow editors to go back from MMV overlay to article

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

This was #65 on the community wishlist and we've solved this in MobileFrontend so I've posted a patch (cc @matmarex who hopefully finds it familiar!). MultimediaViewer and MobileFrontend never run at the same time so this change should be safe.

Change 910522 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@master] Router handling code should be centralized into mmv.bootstrap

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

matmarex assigned this task to Jdlrobson.
matmarex added a project: User-notice.

Thanks @Jdlrobson!

Change 914301 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MultimediaViewer@wmf/1.41.0-wmf.7] Router handling code should be centralized into mmv.bootstrap

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

Change 914301 merged by jenkins-bot:

[mediawiki/extensions/MultimediaViewer@wmf/1.41.0-wmf.7] Router handling code should be centralized into mmv.bootstrap

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

Mentioned in SAL (#wikimedia-operations) [2023-05-03T20:43:15Z] <cjming@deploy1002> Started scap: Backport for [[gerrit:914301|Router handling code should be centralized into mmv.bootstrap (T236591)]]

Mentioned in SAL (#wikimedia-operations) [2023-05-03T20:44:46Z] <cjming@deploy1002> cjming and jdlrobson: Backport for [[gerrit:914301|Router handling code should be centralized into mmv.bootstrap (T236591)]] synced to the testservers: mwdebug1002.eqiad.wmnet, mwdebug1001.eqiad.wmnet, mwdebug2001.codfw.wmnet, mwdebug2002.codfw.wmnet

Mentioned in SAL (#wikimedia-operations) [2023-05-03T20:53:23Z] <cjming@deploy1002> Finished scap: Backport for [[gerrit:914301|Router handling code should be centralized into mmv.bootstrap (T236591)]] (duration: 10m 08s)

Thanks for the help on thus one!

I also backported it.

I've added it to Tech News using the wording

When you close an image that is displayed via MediaViewer, it will now return to the wiki page instead of going back in your browser history. This feature request was voted #65 in the 2023 Community Wishlist Survey.

If that is inaccurate, please update it directly.
(Reminder note: Draft wording by those who are familiar with a task, is always appreciated, so that I (or other Tech News editors) don't have to (try to) learn the entire thing in order to summarize it. Thanks!)