Skip to content

[MacOS] TextField "onChanged" called three times when hitting backspace. #78629

@TeddyLourson

Description

@TeddyLourson

Hi !
I'm currently building a RichTextField/RichTextEditor for Flutter, but I started having some bugs on MacOS that I don't have on other platforms (iOS, Web, Android). I wondered what it was and found out that the backspace key triggers the "onChanged" method multiple times on MacOS (might be the same on Windows or Linux, I don't have access to any of these OS to try, so I don't know).

Steps to Reproduce

  1. Run flutter create bug.
  2. In main.dart : inside the build method of _MyHomePageState, remove everything inside "body" and replace it with this :
TextField(
        onChanged: (text) => print('textChanged'),
      ),
  1. Run on macOS.
  2. Write some text (even a single letter would work).
  3. (Optional) Clear the log console.
  4. Press backspace once.

Expected results: "textChanged" logged 1x in the console.

Actual results: "textChanged" logged 3x in the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowf: material designflutter/packages/flutter/material repository.found in release: 2.0Found to occur in 2.0frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions