Skip to content

[iOS] Holding down Backspace key on hardware keyboard doesn't keep deleting characters in iOS Simulator #96660

@dannyvalentesonos

Description

@dannyvalentesonos

Steps to Reproduce

  1. Run the app using code below on an iOS simulator (iPhone 8 running iOS 14.5) and type something in the field
  2. Then press the backspace button on hardware keyboard and keep it pressed.

Expected results:
The characters should keep getting deleted while holding the backspace button

Actual results:
Only one character gets deleted

This used to work in flutter 2.0.1, but no longer works in 2.8.1 (I haven't tried with 2.5)

Code sample
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,
      ),
      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> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
            TextField(),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
Logs
[✓] Flutter (Channel master, 2.9.0-1.0.pre.362, on macOS 11.6.1 20G224 darwin-x64, locale en-US)
    • Flutter version 2.9.0-1.0.pre.362 at /Users/danny.valente/Library/flutter/9.9.99-master
    • Upstream repository https://github.com/flutter/flutter
    • Framework revision 72df4801c8 (24 minutes ago), 2022-01-13 17:08:35 -0800
    • Engine revision f121c1fe68
    • Dart version 2.17.0 (build 2.17.0-11.0.dev)
    • DevTools version 2.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsfound in release: 2.10Found to occur in 2.10found in release: 2.8Found to occur in 2.8found in release: 2.9Found to occur in 2.9frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions