Skip to content

D-pad navigation on TextField is broken - Android TV #147772

Open

Description

@AlexDicy

Steps to reproduce

  1. create a new flutter project with flutter create test_drive
  2. add a couple of TextFields
  3. flutter run on Android TV device
  4. select the text field
  5. press the back button to close the keyboard
  6. use the D-pad to change focus to another TextField/Widget

Expected results

The D-pad navigation is working and the next widget/text field is focused

Actual results

The use of the d-pad doesn't result in any action. Navigation is broken

Code sample

Code sample
Column(
  mainAxisAlignment: MainAxisAlignment.center,
  children: <Widget>[
    const Text(
      'You have pushed the button this many times:',
    ),
    Text(
      '$_counter',
      style: Theme.of(context).textTheme.headlineMedium,
    ),
    const TextField(),
    TextField(
      decoration: InputDecoration(
        filled: true,
        suffixIcon: IconButton(
          icon: const Icon(
            Icons.visibility,
          ),
          onPressed: () {},
        ),
      ),
    ),
  ],
),

Screenshots or Video

Screenshots / Video demonstration

In the video can be seen the difference between <Tab> navigation on an emulated phone and the broken D-pad navigation on an emulated TV

Desktop.2024.05.03.-.09.55.11.02.mp4

Logs

Logs

No relevant log

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.22.0-23.0.pre.17, on Microsoft Windows [Version 10.0.22631.3447], locale it-IT)
    • Flutter version 3.22.0-23.0.pre.17 on channel master at D:\Dev\Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 183bc15816 (6 hours ago), 2024-05-02 23:09:03 -0700
    • Engine revision d8c8cf4384
    • Dart version 3.5.0 (build 3.5.0-127.0.dev)
    • DevTools version 2.35.0

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at D:\Dev\AndroidSDK
    • Platform android-34, build-tools 34.0.0
    • Java binary at: S:\Program Files\JetBrains\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✗] Visual Studio - develop Windows apps
    ✗ Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[✓] Android Studio (version 2023.2)
    • Android Studio at S:\Program Files\JetBrains\Android Studio
    • 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 17.0.9+0--11185874)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1)
    • IntelliJ at S:\Program Files\JetBrains\IntelliJ IDEA Ultimate
    • Flutter plugin version 79.0.3
    • Dart plugin version 241.15845

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.3447]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 124.0.6367.119
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 123.0.2420.65

[✓] Network resources
    • All expected network resources are available.

Activity

  1. added
    in triage
    on May 3, 2024
  2. darshankawar commented on May 3, 2024

    @darshankawar
    Member

    Thanks for the report @AlexDicy
    Can you take a look at https://api.flutter.dev/flutter/widgets/MediaQueryData/navigationMode.html specially for DPAD navigation and check if using NavigationMode.directional as mentioned in it, helps in your case or not ?

  3. added
    waiting for response
    on May 3, 2024
  4. AlexDicy commented on May 3, 2024

    @AlexDicy
    Author

    Hello @darshankawar, I wrapped the whole widget with MediaQuery like this (I also tried wrapping just the column):

    return MediaQuery(
      data: MediaQuery.of(context).copyWith(navigationMode: NavigationMode.directional),
      child: Scaffold(...),
    );

    The behavior is the same: clicking the central button doesn't re-open the keyboard, clicking the directional buttons don't change the focus.

  5. removed
    waiting for response
    on May 3, 2024
  6. darshankawar commented on May 6, 2024

    @darshankawar
    Member

    Thanks for the update. I was able to replicate the reported behavior using Android TV emulator.

    stable, master flutter doctor -v
    [!] Flutter (Channel stable, 3.19.6, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.19.6 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 54e66469a9 (6 days ago), 2024-04-17 13:08:03 -0700
        • Engine revision c4cd48e186
        • Dart version 3.3.4
        • DevTools version 2.31.1
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.22.0-23.0.pre.43, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.22.0-23.0.pre.43 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision b8abc10689 (12 hours ago), 2024-05-05 13:01:23 -0400
        • Engine revision 624dcb987f
        • Dart version 3.5.0 (build 3.5.0-131.0.dev)
        • DevTools version 2.35.0
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/dhs/Library/Android/sdk
        ✗ cmdline-tools component is missing
          Run `path/to/sdkmanager --install "cmdline-tools;latest"`
          See https://developer.android.com/studio/command-line for more details.
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for
          more details.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13C100
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 65.1.4
        • Dart plugin version 213.7228
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
          • iOS 15.3.1 19D52
        • macOS (desktop)           • macos                                    •
          darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)              • chrome                                   •
          web-javascript • Google Chrome 109.0.5414.119
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
          
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
  7. added
    a: text input
    e: device-specific
    platform-android
    has reproducible steps
    found in release: 3.19
    found in release: 3.22
    team-text-input
    and removed
    in triage
    on May 6, 2024
  8. justinmc commented on May 9, 2024

    @justinmc
    Contributor

    @gspencergoog Looks like you added navigationMode years ago, do you know if it should handle TV remote input like this? I'm not aware of ever doing anything to support this kind of thing in our text fields, not sure if it has ever been supported or not.

  9. added
    triaged-text-input
    P2
    on May 9, 2024
  10. gspencergoog commented on May 10, 2024

    @gspencergoog
    Contributor

    That was the original intent, and it does affect the way text fields accept focus, etc. For instance, TextField will accept focus even when it is disabled when in directional navigation mode.

    It only handles TV remote input that emits directional arrows for the DPAD directions though (like Android TV does). Perhaps something has broken this functionality, though.

  11. zhuhaichao518 commented on Jul 22, 2025

    @zhuhaichao518

    I have exactly the same problem. Any update on this? Is there a workaround for this problem?

  12. zhuhaichao518 commented on Jul 25, 2025

    @zhuhaichao518

    I have created a plugin hosting an native android textfiled as a workaround. native_textfield_tv

  13. added
    a: tv
    on Jan 7, 2026
  14. hasanm08 commented on Jul 3, 2026

    @hasanm08

    recently I created new package to fix this on both Android TVs and Apple TVs
    you can use it
    https://pub.dev/packages/tv_textfield
    @AlexDicy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2a: text inputa: tve: device-specificfound in release: 3.19found in release: 3.22has reproducible stepsplatform-androidteam-text-inputtriaged-text-input

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions