Bug 243813

Summary: [iOS] Scroll position gets reset when back/forward to a page where no viewport is set.
Product: WebKit Reporter: Kyouhei Horizumi <webkit.bugzilla>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   
Attachments:
Description Flags
Steps to reproduce none

Description Kyouhei Horizumi 2022-08-10 23:24:25 PDT
Created attachment 461540 [details]
Steps to reproduce

Case 1:

Scroll position gets reset when back/forward to a page where no viewport is set.
https://webkit-reset-scrolly-when-history-back.pages.dev/


Case 2: 

If viewport.width is specified, it will not be reset.
e.g. `<meta name="viewport" content="width=device-width">`
https://webkit-reset-scrolly-when-history-back.pages.dev/set-viewport-device-width/


Case 3:

However, if any elements extend beyond the <body>, they will be reset.
e.g. `div {inline-size: calc(100% + 1px);}`
https://webkit-reset-scrolly-when-history-back.pages.dev/set-viewport-device-width/over-body-area/


Case 4:

Even in that case, if initial-scale is set, it will not be reset.
e.g. `<meta name="viewport" content="width=device-width, initial-scale=1.0">`
https://webkit-reset-scrolly-when-history-back.pages.dev/set-viewport-device-width/over-body-area/set-initial-scale


In all cases, pinch-in in preserves the scroll position.

----------------------

Steps to reproduce:

Please see attachment (README.jpg).


Expected:

Restore scroll position all cases.


Additional info:

- iOS 15.6 / iPhone SE (2nd Generation)
- Mobile Safari
Comment 1 Simon Fraser (smfr) 2022-08-11 20:43:07 PDT
Possibly fixed by https://commits.webkit.org/253221@main
Comment 2 Radar WebKit Bug Importer 2022-08-17 23:25:18 PDT
<rdar://problem/98816743>
Comment 3 Kyouhei Horizumi 2023-01-10 07:16:59 PST
Confirmed fixed in iOS 16.1.1 (20B101).