Skip to content

EditableText calls onSelectionChanged even if the selection does not change. #76349

Description

@chunhtai

If you add a print statement in this method

void _handleSelectionChanged(TextSelection selection, SelectionChangedCause? cause) {

long press the textfield, you will see the print statement even if text selection does not change. This behavior is contradicted to the EditableText.onSelectionChange contract. Unfortunately, this is needed because textfield relies on this call to update the handle visibility.

We should fix this by refactoring out selection overlay of editable text so that text field does not need to rely on this callback, and then we should finally able to fix the EditableText.onSelectionChanged.

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: tech-debtTechnical debt, code quality, testing, etc.
    on Feb 19, 2021
  2. github-actions commented on Aug 27, 2021

    @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.

  3. locked as resolved and limited conversation to collaborators on Aug 27, 2021
  4. Renzo-Olivares commented on May 14, 2025

    @Renzo-Olivares
    Contributor

    Re-opened this since #87971 was reverted in #88183 and the TODO still exists in the framework. I also verified this issue is still reproducible on master by following the instructions in the issue description.

  5. added
    P2Important issues not at the top of the work list
    and removed
    team-designOwned by Design Languages team
    on May 15, 2025
  6. unlocked this conversation on May 16, 2025
  7. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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 problemsc: tech-debtTechnical debt, code quality, testing, etc.p: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: 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