Skip to content

[Android] [Google Chromecast] Unable to use software keyboard with TextField #177360

Closed

Description

@georgehoss

The software keyboard arrow key navigation is still broken on Chromecast with Google TV devices, making text input impossible without external workarounds.

Environment:

Flutter version: 3.27.1 (also affects 3.24+)
Device: Chromecast with Google TV (4K and HD models)
Android version: Android TV 12
Input method: On-screen software keyboard
Steps to Reproduce:

Create a simple Flutter app with a TextField
Deploy to Chromecast with Google TV via adb
Navigate to the TextField using D-pad (arrow keys)
Software keyboard appears automatically
Try to use arrow keys to navigate letters on the keyboard
Expected: Arrow keys should move between keyboard letters
Actual: Arrow keys do nothing; keyboard is unresponsive
Current Workaround (NOT a solution):

The only way to make the keyboard work is to perform a hot restart:

Run the app: flutter run
Focus any TextField → keyboard shows but arrows don't work
Perform hot restart (r in terminal)
After full restart completes, keyboard arrows suddenly work
If the keyboard closes (pressing Back), the bug returns and requires another restart
Root Cause Analysis:

Based on investigation in the Flutter engine source code, the issue appears to be in InputConnectionAdaptor.java:

https://github.com/flutter/engine/blob/715ede5967c8f8be259d5832da7416a316ea927f/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java#L289-L326

The InputConnectionAdaptor class intercepts arrow key events (onKeyDown/onKeyUp) and handles them in Flutter instead of returning false to let the event propagate to the Android InputMethod (software keyboard).

Theory:

When hot restart occurs, something in the lifecycle resets the input connection state, allowing the InputMethod to properly receive key events. This suggests the Flutter activity or input connection is incorrectly maintaining focus/event capture over the on-screen keyboard.

Attempted Fixes (all failed):

  • ❌ Removing all Flutter shortcuts/actions from TextField
  • ❌ Setting skipTraversal: false on Focus widgets
  • ❌ Returning KeyEventResult.ignored for all arrow keys
  • ❌ Programmatically hiding/showing keyboard via SystemChannels.textInput
  • ❌ Using FocusNode listeners to detect keyboard state
  • ❌ Checking AppLifecycleState changes

None of these Flutter-level solutions work because the problem is in the native Android layer (engine).

Impact:

This makes TextField input completely unusable on Chromecast devices, which represent a significant portion of Android TV users. Users cannot:

Enter email addresses for login
Type search queries
Fill forms
Enter any text input
Related Issues:

#154924 (originally reported, closed as duplicate)
[Add other related issue numbers if found]
Minimum Reproducible Example:

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Container(
            width: 300,
            child: TextField(
              decoration: InputDecoration(
                labelText: 'Test Input',
                border: OutlineInputBorder(),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Run on Chromecast:

adb connect <chromecast-ip>:5555
flutter run -d <device-id>

Expected Behavior:

Arrow keys should navigate the on-screen keyboard letters, allowing text input via remote control (standard Android TV behavior).

Actual Behavior:

Arrow keys are captured by Flutter and do nothing. The keyboard is unresponsive until a hot restart is performed.

Request:

Please investigate the InputConnectionAdaptor implementation to ensure key events are properly propagated to the Android InputMethod when a software keyboard is active on Android TV devices.

Possible Solutions:

Check InputConnection.isKeyboardActive() before handling arrow keys in Flutter
Return false from onKeyDown/onKeyUp when an InputMethod is consuming events
Add Android TV specific handling that defers to the system keyboard
Provide a flag/configuration to disable Flutter's key event interception for TextFields on TV platforms
Additional Context:

This issue specifically affects Android TV devices with software keyboards (Chromecast) but does NOT affect:

Android TV devices with physical keyboards
Android phones/tablets (touch keyboards work fine)
The hot restart workaround proves this is a state/lifecycle issue, not a fundamental incompatibility.

Activity

  1. added
    in triage
    on Oct 23, 2025
  2. huycozy commented on Oct 23, 2025

    @huycozy
    Member

    From triage pov: I unfortunately can't reproduce this issue as I don't have such device on my end.
    However, per #154924 (comment), this issue seems to be valid until now, as it had no bandwidth to solve at that time. Keeping this issue to have team's input.

  3. added
    a: text input
    e: device-specific
    platform-android
    fyi-android
    team-text-input
    and removed
    in triage
    on Oct 23, 2025
  4. added
    P2
    triaged-text-input
    on Oct 23, 2025
  5. added
    triaged-android
    on Oct 28, 2025
  6. removed
    fyi-android
    triaged-android
    on Oct 28, 2025
  7. romaingyh commented on Oct 30, 2025

    @romaingyh
    Contributor

    Hello @georgehoss, as you mentioned the issue I opened last year for this bug so here is what I learned about this :

    • It does not only affect Google Chromecast devices. Some Phillips or Samsung TV are impacted.
    • Google can reject your app during review because of this bug.
    • I tried to tweak InputConnectionAdaptor in engine but I wasn't able to fix it :(
    • I spoke on with a member of the flutter team about this bug on the discord server. He tried to guide me but no success again. I think you can find our messages in the hacker-android channel. Search from: frerebilly
  8. added
    a: tv
    on Jan 7, 2026
  9. alanmartinsdeazevedo commented on Jul 18, 2026

    @alanmartinsdeazevedo

    Confirmed on a physical Google TV device, with evidence that this is a Flutter-side issue, not platform behavior.

    In #154924 the conclusion was that Android TV is moving away from D-pad navigation of the soft keyboard, since native apps appeared to behave the same. We tested this on a physical Google TV (Smart TV) and found otherwise:

    Experiment (same device, same IME, same app):

    1. A regular Flutter TextField: the soft keyboard (Gboard TV) opens, but D-pad arrows never reach it — they move the caret inside the field instead. Typing is impossible. (The reported bug.)
    2. The exact same screen, but with the input rendered as a native Android EditText embedded via a platform view (Flutter draws everything else): the same Gboard TV keyboard is fully D-pad navigable — arrows move across the keys, letters can be selected, IME_ACTION_DONE works, including with TYPE_TEXT_VARIATION_PASSWORD.

    The only difference between the two cases is whether the IME is talking to Flutter's text input (InputConnectionAdaptor) or to a real platform EditText. So the IME does still support D-pad key navigation, but only engages it when the focused editor is a platform text input. This points at the InputConnection/EditorInfo Flutter provides rather than at the arrow key events themselves — consistent with the earlier finding in #154924 that making handleKeyEvent return false didn't help.

    Workaround for anyone blocked by this: embed a minimal EditText as a PlatformView for TV text entry. One caveat: never re-set inputType on updates — each re-assignment triggers restartInput() and Gboard TV resets its highlighted key after every keystroke.

    Happy to share the minimal platform-view implementation or test patches on the device.

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-specificplatform-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