Skip to content

[Web] Textinput is placed with offset above the keyboard when focused #124205

Closed

Description

@NelepovDmitry

Steps to Reproduce

Create a simple app where text editing aligns at the bottom.

  1. After creating the app, upload it on the web and open the Flutter app on the iPhone mobile browser.
  2. Execute the command "flutter build web --web-renderer canvaskit" on the code sample and upload it to the server. You can also check it on https://api.de-team.com/flutter/.
  3. Open the app on the mobile browser. For example, open it on Safari. Tap on the blue editable field.

Expected results:
The expectation is that the keyboard will show up and the blue field will align above the keyboard.

Actual results:
However, the actual results are that all content has bottom insets and there exists extra space between the keyboard and the app content widget. You need to fix this issue to ensure the app performs as expected.

Sample code
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    builder: (context, child) => const MyApp(),
  ));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<StatefulWidget> createState() {
    return _MyAppState();
  }
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.blueAccent,
      child: Column(
        children: [
          const Spacer(),
          Text(
            'Media query inset vertical ${MediaQuery.of(context).viewInsets.vertical}',
            style: const TextStyle(fontSize: 14, color: Colors.black),
          ),
          Padding(
            padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.vertical),
            child: Container(
              padding: const EdgeInsets.all(16),
              color: Colors.indigo,
              child: EditableText(
                controller: TextEditingController(),
                focusNode: FocusNode(),
                style: const TextStyle(fontSize: 14, color: Colors.black),
                cursorColor: Colors.white,
                backgroundCursorColor: Colors.transparent,
              ),
            ),
          ),
        ],
      ),
    );
  }
}

Another example, same result

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    builder: (context, child) => const MyApp(),
  ));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<StatefulWidget> createState() {
    return _MyAppState();
  }
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          const Spacer(),
          Container(
            padding: const EdgeInsets.all(16),
            color: Colors.indigo,
            child: EditableText(
              controller: TextEditingController(),
              focusNode: FocusNode(),
              style: const TextStyle(fontSize: 14, color: Colors.black),
              cursorColor: Colors.white,
              backgroundCursorColor: Colors.transparent,
            ),
          ),
        ],
      ),
    );
  }
}
Details
flutter doctor -v
[✓] Flutter (Channel stable, 3.7.9, on macOS 13.2.1 22D68 darwin-arm64, locale en-RU)
    • Flutter version 3.7.9 on channel stable at /Users/rain/Dev/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 62bd79521d (6 days ago), 2023-03-30 10:59:36 -0700
    • Engine revision ec975089ac
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/rain/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] IntelliJ IDEA Community Edition (version 2022.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 72.1.4
    • Dart plugin version 223.8888

[✓] VS Code (version 1.77.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • iPhone 14 Pro Max (mobile) • 6072A3F4-985F-4748-AC2E-9E71BE2C2C60 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 13.2.1 22D68 darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 111.0.5563.146

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

flutter_keyboard_error.mov

Activity

  1. added
    in triage
    on Apr 6, 2023
  2. darshankawar commented on Apr 6, 2023

    @darshankawar
    Member

    Thanks for the detailed report @NelepovDmitry
    I tried the sample code on physical device (iPhone 6s, OS 15.3.1) in which, the app worked as expected. The keyboard opening and closing is aligned with the text field as shown below:

    RPReplay-Final1680785526.MP4

    I see that you tried on simulator. Can you try the same on physical device and confirm if you still get same behavior or not ?

  3. added
    waiting for response
    on Apr 6, 2023
  4. NelepovDmitry commented on Apr 6, 2023

    @NelepovDmitry
    Author

    Yes, i have same issue on iPhone 14, iPhone 10, Android Samsung S22 Ultra.

    Here is video from Android.

    keyboard_bug_android.mp4
  5. removed
    waiting for response
    on Apr 6, 2023
  6. added
    waiting for response
    on Apr 6, 2023
  7. NelepovDmitry commented on Apr 6, 2023

    @NelepovDmitry
    Author

    Already tried (

    Looks like keyboard make offset whole viewcontroller or activity.

  8. removed
    waiting for response
    on Apr 6, 2023
  9. darshankawar commented on Apr 10, 2023

    @darshankawar
    Member

    Thanks for the update. Are all iphone devices you tried on have OS 16 or lesser ?

  10. added
    waiting for response
    on Apr 10, 2023
  11. NelepovDmitry commented on Apr 10, 2023

    @NelepovDmitry
    Author

    All devices with OS 16+
    I will check if i have some device with less OS version.

  12. removed
    waiting for response
    on Apr 10, 2023
  13. darshankawar commented on Apr 11, 2023

    @darshankawar
    Member

    Also verified on iOS 16 simulator, but not seem to be replicating the behavior.

    Screen.Recording.2023-04-11.at.12.26.38.mov

    Execute the command "flutter build web --web-renderer canvaskit", can you try with html rendering mode as well and see what behavior you get ?

  14. added
    waiting for response
    on Apr 11, 2023
  15. 138 remaining items

  16. ArmandF-Eclipsed commented on Jan 14, 2026

    @ArmandF-Eclipsed

    I can confirm that the issue where white space renders above the keyboard, if the text field is at the bottom of the view, and on Android Web, is still present in the master branch.

    I cloned version 3.40.0-1.0.pre-570.

    ---- Update ----
    Also happens on some iOS web builds, super inconsistent - Android web is still the most replicatable

  17. mdebbar commented on Jan 21, 2026

    @mdebbar
    Contributor

    The issue reported by @andy-tmpt-me with the negative insets is identical to #175074 and was fixed in #179581 (still hasn't made it to stable yet).

    Anyone on the latest master channel can confirm if the issue is fixed or still happening?

    @ArmandF-Eclipsed can you try on the master channel (and don't forget to flutter upgrade)? If the issue is still happening, could you share more details like flutter doctor -v output, code sample, and a video recording of the issue? Thanks!


    Edit: I forgot that the fix was actually cherry-picked to the stable release 3.38.6.

  18. added
    waiting for response
    on Jan 21, 2026
  19. andy-tmpt-me commented on Jan 21, 2026

    @andy-tmpt-me

    I just tested from the latest published Flutter on chrome on a Pixel 8 (actual device) and the issue resolved for me!

  20. ArmandF-Eclipsed commented on Jan 22, 2026

    @ArmandF-Eclipsed

    The issue reported by @andy-tmpt-me with the negative insets is identical to #175074 and was fixed in #179581 (still hasn't made it to stable yet).

    Anyone on the latest master channel can confirm if the issue is fixed or still happening?

    @ArmandF-Eclipsed can you try on the master channel (and don't forget to flutter upgrade)? If the issue is still happening, could you share more details like flutter doctor -v output, code sample, and a video recording of the issue? Thanks!

    Edit: I forgot that the fix was actually cherry-picked to the stable release 3.38.6.

    After pulling the latest master version (v3.41.0-1.0.pre-212), I can confirm that the issue is resolved, provided that you disable the resizeToAvoidBottomInset for Android web in the scaffold.

  21. mdebbar commented on Jan 22, 2026

    @mdebbar
    Contributor

    Thanks @andy-tmpt-me and @ArmandF-Eclipsed for confirming!

  22. sero583 commented on Jan 22, 2026

    @sero583
    Contributor

    A bit late to the party, but I can confirm as well that it works now. Thanks for the fix, @mdebbar!

  23. added
    r: fixed
    on Jan 23, 2026
  24. MrPiou94 commented on Jan 26, 2026

    @MrPiou94
    WhatsApp.Video.2026-01-26.at.18.52.17.mp4

    Hello,

    I confirm that everything is now working correctly. For anyone who might still be experiencing issues, I decided to delete my Flutter directory and start with a clean installation. Everything is working perfectly now.

    Thank you for your adjustments.

    Happy coding to everyone!

  25. removed
    waiting for response
    on Jan 27, 2026
  26. github-actions commented on Feb 10, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  27. locked as resolved and limited conversation to collaborators on Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

👍P2a: text inputassigned for triagebrowser: chrome-androidbrowser: safari-ioscustomer: crowdfound in release: 3.10found in release: 3.7has reproducible stepsplatform-iosplatform-webr: fixedteam-web

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions