Bug 236445

Summary: safe-area-inset values not working for websites added to home screen
Product: WebKit Reporter: Martin <martiminchev>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: 800147, bdakin, ik, luming_yin, martiminchev, thorton, webkit-bug-importer, webkit.bugzilla, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   
Attachments:
Description Flags
Screenshot of the issue in portrait
none
Screenshot of the issue in landscape
none
viewport-fit=contain and display: standalone in web app mode
none
viewport-fit=contain and display: standalone in browser
none
viewport-fit=cover and display: standalone in web app mode none

Martin
Reported 2022-02-10 08:27:27 PST
1. Open in Safari on iPhone with a notch and gesture navigation: https://ios-pwa-safe-insets.glitch.me 2. Rotate to landscape, observe how the text is right above the navigation line. 3. Add to home screen. Open the home screen shortcut. 4. Observe how the text is behind the line both in portrait and landscape.
Attachments
Screenshot of the issue in portrait (88.78 KB, image/png)
2022-02-10 08:36 PST, Martin
no flags
Screenshot of the issue in landscape (85.44 KB, image/png)
2022-02-10 08:37 PST, Martin
no flags
viewport-fit=contain and display: standalone in web app mode (56.08 KB, image/png)
2024-08-16 14:38 PDT, Boolat
no flags
viewport-fit=contain and display: standalone in browser (94.30 KB, image/png)
2024-08-16 14:39 PDT, Boolat
no flags
viewport-fit=cover and display: standalone in web app mode (69.90 KB, image/png)
2024-08-19 05:19 PDT, Boolat
no flags
Martin
Comment 1 2022-02-10 08:36:29 PST
Created attachment 451541 [details] Screenshot of the issue in portrait
Martin
Comment 2 2022-02-10 08:37:25 PST
Created attachment 451542 [details] Screenshot of the issue in landscape
Radar WebKit Bug Importer
Comment 3 2022-02-10 09:06:47 PST
ik
Comment 4 2023-03-30 07:25:05 PDT
Is it possible you forgot to add "viewport-fit=cover" in the <meta name="viewport" /> value? That said, the document should not be drawn behind the gesture pill without this flag, so looks like that's the actual bug?
Martin
Comment 5 2023-03-31 08:02:38 PDT
Adding "viewport-fit=cover" fixes the problem for added-to-homescreen websites. However, for regular Safari it's not needed. In landscape orientation, the inset is available without it. Is this inconsistency intended behavior?
Boolat
Comment 6 2024-08-16 14:38:48 PDT
Created attachment 472193 [details] viewport-fit=contain and display: standalone in web app mode
Boolat
Comment 7 2024-08-16 14:39:20 PDT
Created attachment 472194 [details] viewport-fit=contain and display: standalone in browser
Boolat
Comment 8 2024-08-16 14:40:36 PDT
Have the same issue. I want to keep all the content inside the safe area but navigation line is not considered as "unsafe" and shows on top of the content when viewport-fit=contain is set. And env(safe-area-inset-bottom) is zero! But when I open that exact page inside the browser, not as a web app, then navigation line is still covers the content, but env(safe-area-inset-bottom) is set to compensate that. And what is weird, the env(safe-area-inset-right) and env(safe-area-inset-left) are also set to compensate the side unsafe areas while those areas are already cut by viewport-fit=contain. Here I added some screenshots to show the problem https://bug-236445-attachments.webkit.org/attachment.cgi?id=472193 https://bug-236445-attachments.webkit.org/attachment.cgi?id=472194 And here is the place where you can test it: https://b-kamalov-diginavis.github.io/manifest/contain-standalone/
Boolat
Comment 9 2024-08-19 05:19:24 PDT
Created attachment 472221 [details] viewport-fit=cover and display: standalone in web app mode Another detail! When I set <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">, the cover viewport-fit value starts to work weirdly: position: absolute; bottom: 0; is no longer positioned at the bottom of the screen. It now have the bottom padding equal to env(safe-area-inset-top) and also the env(safe-area-inset-bottom) is presented to compensate the bottom line that is now even lower than bottom: 0. Obviously this is the wrong behaviour
Note You need to log in before you can comment on or make changes to this bug.