Skip to content

Multiline text up/down arrow navigation doesn't work on iOS hardware keyboards #50875

@gschier

Description

@gschier

Steps to Reproduce

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final controller = TextEditingController(
    text: 'This\nspans\nmultiple\nlines',
  );
  
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Demo',
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(20.0),
          child: TextField(
            maxLines: 10,
            controller: controller,
          ),
        ),
      ),
    );
  }
}
  1. Run the above app code on iOS with hardware keyboard connected
  2. Press up/down arrow keys to navigate the multi-line text

Expected results: Should move cursor up/down lines of text. This expected behavior can be observed in iOS apps like Notes or Safari.

Actual results: Moves cursor left/right one position (same behavior as pressing left/right arrow keys).

Flutter seems to support up/down arrow navigation for RawKeyboard (desktop/web I'm assuming) but not iOS hardware keyboards (they don't trigger RawKeyboard events).

It doesn't look like there are any ways to intercept arrow keys on iOS hardware keyboards in Flutter. Please correct me if I'm wrong.

Logs
flutter doctor -v
[✓] Flutter (Channel master, v1.15.4-pre.47, on Mac OS X 10.15.3 19D76, locale en-US)
    • Flutter version 1.15.4-pre.47 at /Users/gschier/.flutter-sdk
    • Framework revision b2b97c2a7e (3 days ago), 2020-02-12 17:18:09 -0800
    • Engine revision e0ebaea590
    • Dart version 2.8.0 (build 2.8.0-dev.9.0 e4c39721c4)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
    • Android SDK at /Users/gschier/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.0
    • ANDROID_HOME = /Users/gschier/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/gschier/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4

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

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.3)
    • IntelliJ at /Users/gschier/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 43.0.3
    • Dart plugin version 193.5731

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.2.0

[✓] Connected device (4 available)
    • Gregory Schier’s iPad • xxx • ios            • iOS 13.3.1
    • macOS                 • macOS                     • darwin-x64     • Mac OS X 10.15.3 19D76
    • Chrome                • chrome                    • web-javascript • Google Chrome 79.0.3945.130
    • Web Server            • web-server                • web-javascript • Flutter Tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemscustomer: crowdAffects or could affect many people, though not necessarily a specific customer.found in release: 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions