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):
- Open https://en.m.wikipedia.org/wiki/Pacific_Ocean (or any article with several images)
- Scroll to the History section and expand it
- Tap on an image
- Use arrows to navigate to the next image (repeat several times if you want, shouldn't make a difference)
- 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
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!