Bug 243813 - [iOS] Scroll position gets reset when back/forward to a page where no viewport is set.
Summary: [iOS] Scroll position gets reset when back/forward to a page where no viewpor...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari 15
Hardware: iPhone / iPad iOS 15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-08-10 23:24 PDT by Kyouhei Horizumi
Modified: 2023-01-10 07:16 PST (History)
5 users (show)

See Also:


Attachments
Steps to reproduce (194.61 KB, image/jpeg)
2022-08-10 23:24 PDT, Kyouhei Horizumi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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).