Bug 273617

Summary: Scroll position is (sometimes) not correctly restored after restoring a page from the back/forward cache
Product: WebKit Reporter: Daniel <random_n0body>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: beidson, karlcow, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: iPhone / iPad   
OS: iOS 17   
Attachments:
Description Flags
Video showing how the scroll position is not correctly restored when going back, and back/forwards
none
Screenshot from a `setInterval(log, 0)` that I had running on the page showing scroll position over time - safari briefly restores the correct scroll position before going back to the wrong one none

Daniel
Reported 2024-05-02 02:42:39 PDT
Created attachment 471249 [details] Video showing how the scroll position is not correctly restored when going back, and back/forwards How to reproduce quite reliably on a test page: 1. Go to https://webkit-bfcache-scroll-restore-bug.myshopify.com/collections/all 2. Enter password rtamay 3. Scroll down a bit (maybe to product 50) 4. Click a product 5. Go back Expected behavior: The scroll position is restored to where one left off Actual behavior: there's sometimes some glitching but 3/4 times one ultimately ends up at nearly the top of the page, as can be seen in the attached video on latest ios safari (Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1). The scroll position is correctly restored in all other browsers and also on desktop safari, just not iOS. It has something to do with the back/forward cache because when just reloading the page the scroll position is correctly maintained.
Attachments
Video showing how the scroll position is not correctly restored when going back, and back/forwards (8.10 MB, video/mp4)
2024-05-02 02:42 PDT, Daniel
no flags
Screenshot from a `setInterval(log, 0)` that I had running on the page showing scroll position over time - safari briefly restores the correct scroll position before going back to the wrong one (1.18 MB, image/jpeg)
2024-05-02 02:44 PDT, Daniel
no flags
Daniel
Comment 1 2024-05-02 02:44:08 PDT
Created attachment 471250 [details] Screenshot from a `setInterval(log, 0)` that I had running on the page showing scroll position over time - safari briefly restores the correct scroll position before going back to the wrong one
Radar WebKit Bug Importer
Comment 2 2024-05-06 12:59:13 PDT
Note You need to log in before you can comment on or make changes to this bug.