Skip to content

Text selection handles near screen edges trigger Android system back gesture #187647

Description

@saibotma

When dragging Flutter TextField selection handles close to the left or right device edge on Android gesture navigation, the system back gesture can be triggered instead of continuing the text selection drag.

This does not appear to happen with a native Android text input. In the repro app, the Flutter TextField and a native text input from flutter_native_text_input are shown on the same screen for comparison.

Video

FILE.2026-06-06.15.02.26.mp4

Steps to reproduce

  1. Create a new Flutter app.
  2. Add flutter_native_text_input as a dependency.
  3. Replace lib/main.dart with the file below.
  4. Run the app on an Android device with gesture navigation enabled.
  5. In the Flutter TextField, select text so the selection handles are visible.
  6. Drag either selection handle toward the left or right edge of the screen.
  7. Compare the same interaction in the native text input below it.

Expected result

Dragging a text selection handle near the screen edge should continue adjusting the text selection, matching native Android text field behavior.

Actual result

Dragging a Flutter TextField selection handle near the left or right screen edge can trigger the Android system back gesture.

Possibly related

Repro

lib/main.dart:

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_native_text_input/flutter_native_text_input.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
  runApp(const MaterialApp(home: Repro()));
}

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

  @override
  State<Repro> createState() => _ReproState();
}

class _ReproState extends State<Repro> {
  static const text =
      'Select this text and drag the selection handles close to the left or right screen edge. '
      'Compare Flutter TextField with the native Android EditText below.';

  late final flutterController = TextEditingController(text: text);
  late final nativeController = TextEditingController(text: text);

  @override
  void dispose() {
    flutterController.dispose();
    nativeController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Text selection edge repro')),
      body: ListView(
        padding: const EdgeInsets.all(8),
        children: [
          const Text('Flutter TextField'),
          TextField(controller: flutterController, maxLines: 5),
          const SizedBox(height: 32),
          const Text('Native text input package'),
          SizedBox(
            height: 140,
            child: NativeTextInput(controller: nativeController, maxLines: 5),
          ),
        ],
      ),
    );
  }
}

Flutter 3.44.1
Pixel 7

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.fyi-androidFor the attention of Android platform teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions