Page MenuHomePhabricator

Closing mediaviewer can unexpectedly close browser tab
Closed, DuplicatePublic

Description

Problem

When opening a link like the following in a "new tab" tab in Chrome or Firefox, and then closing it, results in the page being departed from entirely. The expected behaviour is to return to the article (even if the user wasn't on the article prior).

  1. Use Chrome or Firefox
  2. In any empty window or tab, paste the url https://en.wikipedia.org/wiki/Stadsschouwburg#/media/File:Stadsschouwburg,_Amsterdam_2333.jpg and navigate there.
  3. After it loads, press the Close button.

The most common way that I encounter this bug is when re-opening a page from the browser history, to continue where I left off. Or, when switching browser profiles.

I rarely encounter these as normally shared URLs, although that does happen sometimes as well. I find that in social media and instant messaging, the most common way I see images shared is through the MMV urls.

Other notes

I notice that whenever this problem happens, the title in the browser window is different from when it works as expected.

When it works as expected (the image can be closed and focus returns to the article), then prior to closing the image, the browser window title is that of the image file name.

When it fails (closing the image results in the browser tab being emptied entirely), then the browser window title was that of the article instead. E.g. opening https://en.wikipedia.org/wiki/Stadsschouwburg#/media/File:Stadsschouwburg,_Amsterdam_2333.jpg in a new window results in the window title being "Stadsschouwburg - Wikipedia". Opening the article instead and selecting the image, then the title is "Stadsschouwburg, Amsterdam 2333 - Stadsschouwburg - Wikipedia".

Event Timeline

Krinkle renamed this task from Closing mediaviewer can close tab to Closing mediaviewer can unexpectedly close browser tab.Jan 5 2020, 1:18 AM

Is this constantly reproducible, also in a private browser window? I cannot reproduce in Firefox, closing MediaViewer brings me to the article...

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.

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

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: Exiting an image displayed via mediaviewer on wikipedia takes you back one site in browser history instead of taking you to base article, with the previous history entry being chrome://newtab or such.