Bug 255852

Summary: [css-values] Viewport units are often wrong in IABs using WKWebView
Product: WebKit Reporter: Johannes Odland <johannes.odland>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: karlcow, simon.fraser, webkit-bug-importer, wenson_hsieh, zalan
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=255708
https://bugs.webkit.org/show_bug.cgi?id=254868
Attachments:
Description Flags
Viewport unit test in Facebook IAB (small viewport)
none
Viewport unit test in Facebook IAB (large viewport) none

Johannes Odland
Reported 2023-04-23 23:31:04 PDT
Created attachment 466060 [details] Viewport unit test in Facebook IAB (small viewport) A common issue in In App Browsers (IABs) is that the viewport units is incorrectly sized. One issue seems to be caused by SFSafariViewController having setting the wrong sizes, this is reported here: https://bugs.webkit.org/show_bug.cgi?id=255708 In apps that use WKWebView we have to rely on the app developer setting the sizes correctly. The sizes can be set using `setMinimumViewportInset(_:maximumViewportInset:)`: https://developer.apple.com/documentation/webkit/wkwebview/3974127-setminimumviewportinset Unfortunately, many apps doesn't set the viewport insets for their IABs. One example is the Facebook app, where 100vh, 100svh, 100lvh and 100dvh are all updated to be the same height as the current viewport heigh. (They all act as 100dvh). As these apps have a large user base, these IABs are a major hurdle in adapting the new viewport units. It's necessary to build fallbacks for these IABs specifically. As 100vh is dynamically sized, they cause reflow when the user is changing scrolling directions. Could setting minimum and maximum viewport sizes be enforced?
Attachments
Viewport unit test in Facebook IAB (small viewport) (457.68 KB, image/png)
2023-04-23 23:31 PDT, Johannes Odland
no flags
Viewport unit test in Facebook IAB (large viewport) (482.42 KB, image/png)
2023-04-23 23:31 PDT, Johannes Odland
no flags
Johannes Odland
Comment 1 2023-04-23 23:31:35 PDT
Created attachment 466061 [details] Viewport unit test in Facebook IAB (large viewport)
Johannes Odland
Comment 2 2023-04-23 23:38:27 PDT
Another example of an app where the viewport units end up wrong is the Firefox app: https://github.com/mozilla-mobile/firefox-ios/issues/11574 https://github.com/mozilla-mobile/firefox-ios/issues/8819
Radar WebKit Bug Importer
Comment 3 2023-04-25 19:06:04 PDT
Note You need to log in before you can comment on or make changes to this bug.