You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2026/08/26 08:23:57 UTC

(cordova-ios) 01/01: doc(CDVViewController): document `scrollViewDidChangeAdjustedContentInset:`

This is an automated email from the ASF dual-hosted git repository.

GitToTheHub pushed a commit to branch pr-doc-scrollViewDidChangeAdjustedContentInset
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git

commit 868f14bac6508cf95d67cf47fb8a80a42a126335
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Wed Aug 26 10:23:42 2026 +0200

    doc(CDVViewController): document `scrollViewDidChangeAdjustedContentInset:`
    
    - Make clear that this is called when the ?`WKWebView` is initialized and also when `viewport-fit` is changed.
---
 CordovaLib/Classes/Public/CDVViewController.m | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/CordovaLib/Classes/Public/CDVViewController.m b/CordovaLib/Classes/Public/CDVViewController.m
index 3c24d7b0..fd595a8a 100644
--- a/CordovaLib/Classes/Public/CDVViewController.m
+++ b/CordovaLib/Classes/Public/CDVViewController.m
@@ -578,6 +578,11 @@ static UIColor *defaultBackgroundColor(void) {
     }
 }
 
+/**
+ * This is called initially when the WKWebView is initialized and also when viewport-fit is changed.
+ * WebKit still doesn't expose _webView:didChangeSafeAreaShouldAffectObscuredInsets: as public API,
+ * so we need to react based on the scrollView delegate.
+ */
 - (void)scrollViewDidChangeAdjustedContentInset:(UIScrollView *)scrollView
 {
 #if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
@@ -586,6 +591,9 @@ static UIColor *defaultBackgroundColor(void) {
         return;
     }
 
+    // Detect changes on viewport-fit:
+    // viewport-fit=cover causes the contentInsetAdjustmentBehavior to be UIScrollViewContentInsetAdjustmentNever
+    //
     // On Mac Catalyst, Cordova may manually constrain the web view below the title bar.
     // In that case automatic scroll-view inset adjustment is disabled, so the synthetic
     // status bar view should be hidden.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org