WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
191872
WkWebView does not set the `env(safe-area-inset-*)` CSS variables until some arbitrary time after page load.
https://bugs.webkit.org/show_bug.cgi?id=191872
Summary
WkWebView does not set the `env(safe-area-inset-*)` CSS variables until some ...
Chet Corcos
Reported
2018-11-20 17:50:17 PST
This app linked to below shows an html webpage inside a WKWebView that measures the env(safe-area-inset-*) css variables. You will notice that these variables are not available on the initial load of the app, or after the window load event, or the document DOMContentLoaded event. These CSS variables only seem to be available at some arbitrary time after the app is loaded. However, if you open up the same webpage (
http://localhost:8000/
) in iOS Safari in landscape mode and hit refresh, you'll notice that these CSS variables are available at initial load time.
https://github.com/ccorcos/WkWebView-Safe-Area-Inset-Bug
Please try it out and give it a spin. ``` git clone
https://github.com/ccorcos/WkWebView-Safe-Area-Inset-Bug
cd WkWebView-Safe-Area-Inset-Bug # Server the index.html file python -m SimpleHTTPServer 8000 # Open Xcode and run the app. open WebViewBug.xcodeproj ```
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-11-20 19:01:59 PST
<
rdar://problem/46193462
>
Brian Arpie
Comment 2
2020-04-23 11:57:27 PDT
Any update on this bug? I can reproduce on iOS 13.
super.xhmm
Comment 3
2022-12-23 09:47:39 PST
Same problem here for ios 16, this issue caused the fixed bottom button had a sudden jump when page doms were some complicated, because the first render safa-area-inset-bottom was zero, next render it become 34px, but when page was simple, no jump happened
super.xhmm
Comment 4
2022-12-23 09:47:57 PST
Same problem here for ios 16, this issue caused the fixed bottom button had a sudden jump when page doms were some complicated, because the first render safa-area-inset-bottom was zero, next render it become 34px, but when page was simple, no jump happened
Evan Owen
Comment 5
2023-01-27 17:53:15 PST
We're also struggling with this bug still in iOS 16 still. All of the safe-area-inset-* CSS env vars are zero until shortly after the webview is initialized sub-second, but noticeable). It happens both when first launching an app into a WKWebView and also restoring after the app's been suspended. Because it's non-deterministic, it's very hard to work around manually.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug