Created attachment 403288 [details] Animated GIF to illustrate the problem. Steps to reproduce: 1. On Mobile Safari on iOS 13.5.1 open the URL https://bugreport2.zemtu.com 2. Touch scroll to the red rectangle and click on it 3. Press the arrow / back button 4. Some of the green rectangles on the top of the screen are no longer visible 5. Touch scroll just a little bit to make these rectangles visible again Please retry several times as it may not occur all the time. Usually you have to try 2 - 4 times to see the problem. This problem can also be reproduced in the XCode iOS simulator. The problem cannot be reproduced under macOS Catalina 10.15.5 (19F101) in these browsers: - Safari Version 13.1.1 (15609.2.9.1.2) - Google Chrome Version 83.0.4103.116 (Offizieller Build) (64-Bit) - Firefox 77.0.1 (64-Bit) - Opera 68.0.3618.173 - Microsoft Edge 83.0.478.56 (Offizielles Build) (64-Bit)
<rdar://problem/64994694>
I can reproduce on iOS 13.4.
Also reproduces in iOS 14 beta. Sometimes it fails to restore the scroll position.
The failure to restore the scroll position (which also happens on macOS) happens because we try to restore the scroll position from FrameLoader::HistoryController::restoreScrollPositionAndViewState() but this happens before we've done a layout for the new size, so we end up clamping the scroll position to zero.
The page doesn't build the new content until some time after the back(), using JS running on a timer, so we have no hope of restoring the correct scroll position.
On iOS this goes through WebFrameLoaderClient::restoreViewState().