Skip to content

Can't drag to select with a mouse in TextField on iOS/iPadOS #105639

@Renzo-Olivares

Description

@Renzo-Olivares

Dragging to select with a mouse on a TextField should select the range of text from the position where the drag started to the position where the drag moves to. On iPad it selects a few characters and stops.

Tested on master & stable.

Screen.Recording.2022-06-07.at.1.40.34.PM.mov

To reproduce

  1. Run any app with text field, such as the one below.
  2. Focus the field and enter a couple of lines of text.
  3. Drag from one position in the text to another position.

Expected: The text between the start position of the drag and moved position of the drag is selected.
Actual: Few characters are selected and then stops.

Code
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController _controller = TextEditingController(text: 'Atwater Peel Sherbrooke Bonaventure');

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: TextField(
          controller: _controller,
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.team-text-inputOwned by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions