Skip to content

Don't duplicate Semantics logic in TextField and CupertinoTextField #181873

Description

@justinmc

We should move all possible Semantics logic out of the design languages and into EditableText, to be DRY and to make sure that direct users of EditableText can easily get nitty gritty semantics details right.

Background

Currently, EditableText only includes a Semantics widget for toolbar operations:

child: Semantics(
inputType: inputType,
onCopy: _semanticsOnCopy(controls),
onCut: _semanticsOnCut(controls),
onPaste: _semanticsOnPaste(controls),
child: _ScribbleFocusable(

Meanwhile in TextField and in CupertinoTextField, there is Semantics logic for gestures and focus that is relevant to all users of text input.

Recommendation

We should move all possible common semantics logic out of TextField/CupertinoTextField and into EditableText.

As a part of that PR, we should also move the test mentioned in https://github.com/flutter/flutter/pull/181722/files#r2760694144 back to the Widgets library, since it tests this semantics logic.

Resources

This came up in: https://github.com/flutter/flutter/pull/181722/files#r2760694144

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 problemsteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions