Skip to content

Shift tap on an unfocused field #97534

Closed

Description

@justinmc

Currently, shift+tap on an unfocused field continues the selection that was last in that field. This seems to be correct for all platforms except for Mac, which always starts the selection at 0. We should get this behavior correct on Mac too.

CC @dkwingsmt, who noticed this in #95213 (comment).

To reproduce

  1. Run the app below on Mac (or just use any text field).
  2. Type something in the input.
  3. Unfocus the field by clicking elsewhere.
  4. Hold shift and tap in the middle of the field.

Expected behavior: The selection goes from 0 to the click location.
Actual behavior: The selection goes from the previous cursor location (end of the field) to the click location.

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: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Demo'),
        ),
        body: const Center(
          child: TextField(),
        ),
      ),
    );
  }
}

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    platform-macosBuilding on or for macOS specifically
    on Jan 31, 2022
  2. self-assigned this
    on Jan 31, 2022
  3. added
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jan 31, 2022
  4. github-actions commented on Feb 25, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  5. locked as resolved and limited conversation to collaborators on Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesplatform-macosBuilding on or for macOS specifically

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions