Skip to content

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

@chunhtai

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.

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.f: material designflutter/packages/flutter/material repository.frameworkflutter/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