Page MenuHomePhabricator

As a user, after closing the media viewer I would like to land back at the part of the article I was on
Closed, ResolvedPublic3 Estimated Story Points



If I'm reading an article on mobile web, click on a piece of media, then use the arrows to scroll through 1 or more images, when I close the media viewer I land back at the top of the article, rather than where I was when I clicked on a piece of media/opened the Media Viewer. As a result I have to then scroll back down to where I was in the article.

Steps to Reproduce

Mobile web (iOS & Android):

  1. Open (or any article with several images)
  2. Scroll to the History section and expand it
  3. Tap on an image
  4. Use arrows to navigate to the next image (repeat several times if you want, shouldn't make a difference)
  5. Close media viewer

I will land in the History section (or wherever in the article I opened the first image from)
I land back at the top of the article

Environments Observed

Mobile Web
Browser Version

OS Version
iOS v11.2.6

Device Model
iPhone 6S

Device Language

Developer notes

The ImageOverlay.EVENT_EXIT fires an event when it closes.
Thus loadImageOverlay inside skins.minerva.scripts/init.js has access to the scrollTop position at the time an image is clicked and access to a point in time when the image is closed. Thus, it should be feasible to record scroll top position and restore it at the end of the event.

Ideally this would happen for all overlays which would take us to the OverlayManager in MobileFrontend. It seems feasible that this could do the same.

The EditorOverlay already does this (click on an edit section link and try closing the overlay)
Let's move this logic from EditorOverlay into the OverlayManager.

Note that there is an opportunity to address parts of T188708 in this task. Go for it!

Event Timeline

Thanks for the detailed report! For the desktop media viewer this is T73796: Media Viewer: Scroll position is lost on original page after accessing the original file. (The mobile viewer is a separate product. I'm not sure what the correct tag for that is, Readers-Web-Backlog maybe?)

alexhollender edited projects, added Readers-Web-Backlog; removed MediaViewer, Multimedia.

@Tgr Thanks for that. Updating this to remove the desktop related issue, and re-tagging.

ovasileva triaged this task as Medium priority.Mar 11 2018, 5:20 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson set the point value for this task to 3.

Change 439956 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] OverlayManager should restore user's scroll when closing an overlay

Change 439956 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] OverlayManager should restore user's scroll when closing an overlay

Awesome! Confirmed this is working correctly on:

@Jdlrobson I noticed that there is a flash of the top of the article right before the media loads. Is this something we could tackle in this ticket, or worth making a separate ticket? Check out this screen recording (I extended the frame where the top of the article flashes):

@Niedzielski ah nice, will add this bug to that ticket, and keep this ticket moving along. Thanks!

Looks fixed to me on a handful of devices both Android and iOS. Also verified on Chrome, Safari, Firefox, Maxthon, and Opera

Tested on Staging with this article:

ovasileva added a subscriber: ovasileva.

all done here.