Skip to content

Field doesn't scroll on paste from keyboard #98675

@justinmc

Description

@justinmc

If you paste with the keyboard while the cursor is offscreen, the cursor should be scrolled into view, but it isn't.

Steps to reproduce

  1. Run any app with a multiline text field, such as the one below, on a device with a keyboard that can paste (e.g. cmd+v).
  2. Enter more lines of text than can be displayed, so that the field scrolls.
  3. Copy some text.
  4. Place the cursor at the end of the field.
  5. Scroll to the top of the field.
  6. Paste with the keyboard.

Expected: The field scrolls to bring the cursor into view.
Actual: The field seems to wobble but doesn't scroll down.

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(maxLines: 2),
        ),
      ),
    );
  }
}

Related: #98604 (comment)

CC @tgucio

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.team-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions