Note: The scroll restoration works perfectly if you open the overlay once, but dare you open it a second time...
It also only impacts users who use the browser navigation controls. Clicking "X" restores scroll position every time.
Related: T209418
Steps to Reproduce (1)
- Visit https://en.m.wikipedia.org/wiki/Charles_Darwin?oldid=871874243 in the MinervaNeue mobile skin on desktop browser
- Scroll down to an image deep in the article such as the evolutionary tree diagram
- Tap the image
- Press browser back button
- Press browser Forward button
- Press browser back button
Steps to Reproduce (2)
- Visit https://en.m.wikipedia.org/wiki/Charles_Darwin in the MinervaNeue mobile skin
- Scroll down to an image deep in the article such as the evolutionary tree diagram
- Tap the image
- Tap details
- Press browser back button twice
Expected Results
- Scroll offset in page is unchanged
Actual Results
- Scroll location is reset to the top
Environments Observed
- enwiki prod
Browser Version
- Chrome v71.0.3578.57
OS Version
- Chrome OS v11151.33.0
Device Model
- Pixel Slate
Device Language
- English
Developer notes
- When an Overlay is shown using Overlay.prototype.show window.pageYOffset is stored locally in a variable called scrollTop
- When hide is executed, that scrollTop is passed back and restored in the hide function.
- Note it is also set inside the OverlayManager (_checkRoute method)
- On clicking the image, this.scrollTop is set correctly
- On clicking back, this.scrollTop is restored.
- When clicking forward, this.scrollTop is set incorrectly as "1"
Removing the handling in checkRoute fixes this problem at the cost of breaking things not using the OverlayManager.
It doesn't look like any of our Overlay's are not using the OverlayManager so it should be safe to remove this code altogether \o/