Skip to content

iOS InAppWebView: With resizeToAvoidBottomInset: true, the white padding area above the keyboard is too large, causing content to disappear off the top #2595

Open
@gerri0098

Description

@gerri0098

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

  1. Use InAppWebView with resizeToAvoidBottomInset: true.
  2. An input field Inside a web drawer.
  3. Tap the input field on an iOS device (e.g., iPhone 14, iOS 18).
  4. Observe the content shift.

Expected Behavior

Content adjusts to stay visible above the keyboard

Steps with code example to reproduce

Steps with code example to reproduce
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: true, // keyboard
      body: ColorfulSafeArea(
        color: AppColors.statusBarColor,
        child: InlineWebview(
          webviewKey,
          AppSettings.appUrl,
          AppSettings.appTitle,
        ),
      ),
    );
  }

......

InAppWebViewSettings webViewSettings = InAppWebViewSettings(
    useShouldOverrideUrlLoading: true,
    mediaPlaybackRequiresUserGesture: false,
    useHybridComposition: true,
    allowsInlineMediaPlayback: true,
    // allow http
    mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW,
    allowFileAccessFromFileURLs: true,
    allowUniversalAccessFromFileURLs: true,
    allowFileAccess: true,
    allowContentAccess: true,

    // viewport
    enableViewportScale: true,

    // keyboard
    contentInsetAdjustmentBehavior:
        ScrollViewContentInsetAdjustmentBehavior.AUTOMATIC,

    // for google auth
    userAgent: AppSettings.userAgentApp,
    javaScriptEnabled: true,
    useOnLoadResource: true,
    cacheEnabled: kDebugMode ? false : true,
    applicationNameForUserAgent: AppSettings.appName,
    disableDefaultErrorPage: true,
    sharedCookiesEnabled: true,
    supportMultipleWindows: true,

    // allow debug
    isInspectable: true,
  );

......

InAppWebView(
        key: webViewKey,
        initialUrlRequest: URLRequest(url: WebUri(widget.url)),
        initialSettings: webViewSettings,

Stacktrace/Logs

Stacktrace/Logs
<Replace this line by pasting your stacktrace or logs here>

Flutter version

Flutter 3.29.2 • channel stable

Operating System, Device-specific and/or Tool

iOS 18.3.2

Plugin version

v6.0.0, v6.1.5, v6.2.0-beta.2

Additional information

Image

I tested native WKWebView in SwiftUI, and it doesn't have this issue. The white padding area above the keyboard is appropriately sized, around a few dozen pixels, and doesn’t push content off-screen.
This issue occurs only on iOS; Android devices do not exhibit this problem.

Self grab

  • I'm ready to work on this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions