Skip to content

Right clicking text on Linux and Windows shouldn't change the selection #101587

@justinmc

Description

@justinmc

This is the behavior I see natively on TextEdit on Linux when I right click, tested on my work computer and my personal Ubuntu machine:

out

Windows Notepad is the same.

However, currently Flutter on all platforms seems to change the selection and move the context menu, which is the native Mac behavior:

out

Flutter should match the native Linux and Windows behavior.

How to reproduce

  1. Run any Flutter app with a text field, such as the example given below.
  2. Enter some text.
  3. Right click on some text in the field other than where the cursor is.

Expected: The selection doesn't change and the menu is dismissed, on Linux and Windows.
Actual: The clicked word is selected and the menu moves to the new location.

Example code
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(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(),
          ],
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopa: fidelityMatching the OEM platforms bettera: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13frameworkflutter/packages/flutter repository. See also f: labels.platform-linuxBuilding on or for Linux specificallyplatform-windowsBuilding on or for Windows specificallyr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions