Bug 294685

Summary: [Liquid Glass] Introduce new API to specify obscured content insets on WKWebView
Product: WebKit Reporter: michaeldo
Component: WebKit Misc.Assignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: jer.noble, karlcow, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P1 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: Unspecified   

michaeldo
Reported 2025-06-18 11:18:21 PDT
To implement UI elements that match the liquid glass design on top of a WKWebView, we need to shift the web view content to prevent toolbars from obscuring the website when it's at the very top or bottom of the screen. We've attempted to achieve this using the WKScrollView’s `contentInset` property; however, changes to `contentInset` do not correctly update the page’s viewport, leading to incorrectly laid out fixed-position elements. Please see the attached screen recording for an example: [Simulator Screen Recording - iPhone 16 Pro - 2025-06-13 at 13.39.27.mov](https://drive.google.com/file/d/104vmllNHXFAEmOVRRFGTzj01Ckadq96K/view?usp=sharing). Additionally, there's no mechanism to manage the `dvh` (dynamic viewport height) value, which becomes apparent with the liquid glass design. Refer to this screen recording for an illustration: [Simulator Screen Recording - iPhone 16 Pro - 2025-06-13 at 10.28.18.mov](https://drive.google.com/file/d/1Sy7As1vWHEvEPMibfAS_dGAtnL6ylH2q/view?usp=sharing). We are seeking APIs that would allow us to adjust WKWebView content to accommodate transparent, resizable native UI elements at the top and bottom, which can be resized dynamically, for example alongside scrolling. Furthermore, we need to ensure that embedded scroll and flex elements behave correctly. Please refer to these examples: [bad_scroll_inifinite_craft.mov](https://drive.google.com/file/d/10ioeu7m1IkDFyhuJRPsCfqb2MWiTE4mp/view?usp=sharing) and [bad_flex_footer.mov](https://drive.google.com/file/d/1vsUrfkyXMUW6QPGFQRvxo_xtRLGxfDop/view?usp=sharing). It's important to note that the `scrollViewDidScroll` method of `UIScrollViewDelegate` is not being called in these scenarios.
Attachments
Radar WebKit Bug Importer
Comment 1 2025-06-20 00:03:58 PDT
Wenson Hsieh
Comment 2 2025-06-20 07:36:09 PDT
Also tracked in rdar://153753916 (FB18184586). We should consider making `-[WKWebView _setObscuredInsets:]` public, and on macOS as well. Possibly also `-_overrideLayoutParametersWithMinimumLayoutSize:minimumUnobscuredSizeOverride:maximumUnobscuredSizeOverride:`.
Wenson Hsieh
Comment 3 2025-07-06 16:10:11 PDT
EWS
Comment 4 2025-07-13 16:04:35 PDT
Committed 297319@main (4233e371219b): <https://commits.webkit.org/297319@main> Reviewed commits have been landed. Closing PR #47634 and removing active labels.
EWS
Comment 5 2025-07-16 00:46:06 PDT
Committed 297297.31@safari-7622-branch (2ef936f46f4e): <https://commits.webkit.org/297297.31@safari-7622-branch> Reviewed commits have been landed. Closing PR #3238 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.