Bug 210009
Summary: | window.innerHeight is broken in WKWebView with viewport-fit=cover | ||
---|---|---|---|
Product: | WebKit | Reporter: | evangun2001 |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | f.miguel.r.oliveira, hi, ik, schauerte, thorton, webkit-bug-importer, wenson_hsieh, xtassin |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Local Build | ||
Hardware: | iPhone / iPad | ||
OS: | iOS 13 |
evangun2001
When `viewport-fit=cover` is used in Cordova with the WKWebView plugin, `window.innerHeight` reports a wrong value.
Instead of reporting the proper window height, it reports the window height MINUS the safe areas insets.
Even a minimalistic snippet will demonstrate the issue: https://gist.github.com/louisameline/d5ae03b07db8185051346b8da55a2704
The issue happens only if the content of the page is smaller in height than the window height.
Exemple: if my iPhone window is 812px high, and the "natural height" of my page is 500, `window.innerHeight` returns 734 (= 812 - 44 top safe area inset - 34 bottom safe area inset). If my page content is 750px high, `window.innerHeight` returns 750, and if my page content overflows the window, `window.innerHeight` returns 812.
Additional notes:
- The `window.innerHeight` value is not longer false after a rotation of the screen
- The bug does not happen in Chrome, Safari, UIWebView, Ionic WKWebView, Capacitor
- It was previously brought to the Cordova team, who suggested to report it here: https://github.com/apache/cordova-plugin-wkwebview-engine/issues/108
Thanks
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
evangun2001
Tested on iPhone XS, iOS 13.4, Xcode 11.4, cordova-ios 5.1.1, cordova-plugin-wkwebview-engine 1.2.1
Radar WebKit Bug Importer
<rdar://problem/61378008>
ik
This also affects standalone web apps, see https://bugs.webkit.org/show_bug.cgi?id=237961