Skip to content

Selection menu doesn't show after entering text then clearing/deleting #35998

@justinmc

Description

@justinmc

After #33293 was merged, a commenter pointed out that this similar problem still exists.

Steps to reproduce

  1. Run an app with a TextField (see below for an example).
  2. Long press the field and the selection menu should show (correct).
  3. Type some text and long press outside of the text to show the menu again (correct).
  4. Delete the text so the field is empty and long press again. The menu won't be shown (incorrect!).

Code

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(),
      title: 'Text Field Test',
      home: MyApp(),
    );
  }
}
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("TextField Test"),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(16.0),
          mainAxisAlignment: MainAxisAlignment.center,
          child: TextField(),
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions