Bug 212371

Summary: New page loaded with a negative content offset for the first time
Product: WebKit Reporter: Daohan Chong <dh.chong>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Critical CC: beidson, ddkilzer, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: Mac   
OS: macOS 10.15   
Attachments:
Description Flags
Demo project (need to be run on macCatalyst)
none
Screenshot none

Description Daohan Chong 2020-05-26 06:15:19 PDT
On Safari Version 13.1 (15609.1.20.111.8) of macOS, there is a bug:
When opening a page for the first time, the content has a negative offset on the vertical direction.

This can also be reproduced with macCatalyst and WKWebView.


Repro steps:

1. Search some keywords on Google, such as "Keyshot"
2. Open keyshot.com on Google search results
3. Observe the content offset

If you resize the Safari window, the bug will disappear.
Comment 1 Daohan Chong 2020-05-26 06:21:52 PDT
Created attachment 400241 [details]
Demo project (need to be run on macCatalyst)

Attaching a demo project.

Please note that this should be run on mac catalyst
Comment 2 Daohan Chong 2020-05-26 06:23:35 PDT
Created attachment 400242 [details]
Screenshot

Attaching a screenshot
Comment 3 Radar WebKit Bug Importer 2020-05-26 06:42:48 PDT
<rdar://problem/63622170>
Comment 4 Tim Horton 2020-05-26 10:13:12 PDT
This reproduces for me.

You can work around this (I tried in your test app) by avoiding the safe area:

webView.frame = view.bounds.inset(by: view.safeAreaInsets)

but ... we should figure out why this isn't working, since it works fine on iOS.
Comment 5 Daohan Chong 2020-08-10 17:10:33 PDT
This bug still exists on Version 14.0 (16610.1.23.1.3), Big Sur beta
Comment 6 Daohan Chong 2020-09-17 08:08:04 PDT
Adding a new radar: FB8704777
Comment 7 David Kilzer (:ddkilzer) 2020-09-22 10:00:35 PDT
(In reply to Daohan Chong from comment #6)
> Adding a new radar: FB8704777

The interesting thing about this bug report (per the reporter) is that it demonstrates that this bug also affects MobileSafari.
Comment 8 Daohan Chong 2020-10-05 05:16:11 PDT
(In reply to David Kilzer (:ddkilzer) from comment #7)
> (In reply to Daohan Chong from comment #6)
> > Adding a new radar: FB8704777
> 
> The interesting thing about this bug report (per the reporter) is that it
> demonstrates that this bug also affects MobileSafari.

Desktop Safari is also affected. Not 100% repro.
Comment 9 Daohan Chong 2021-06-17 19:22:17 PDT
Any updates on this bug?

It can still be reproduced on macOS 12.0 beta.

In addition, on iOS 14.x, `SFSafariViewController` can sometimes repro this bug.