Skip to content

Obscured text field content is copy-able #24100

Closed

Description

@0x0blu

Steps to Reproduce (tested on iOS only)

  1. Create a TextField widget with obscureText set to true
  2. Write some text in there and long-press it
  3. Press copy and paste it anywhere else

What Was Expected

Copy option not to even appear, and not to reveal any of the data

What Happened

I could copy the obscured text

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    a: fidelityMatching the OEM platforms better
    on Nov 9, 2018
  2. added this to the milestone on Nov 9, 2018
  3. justinmc commented on Nov 19, 2018

    @justinmc
    Contributor

    You can work around this for now by using enableInteractiveSelection:

    // Password field
    TextField(
      obscureText: true,
      enableInteractiveSelection: false,
    );

    I think you're right that this is pretty nonintuitive for someone just looking to create a password field, though. The PR above will change the defaults so that enableInteractiveSelection will default to false when obscureText is true.

  4. 0x0blu commented on Nov 19, 2018

    @0x0blu
    Author

    I believe currently in Android and iOS, the interactive selection is not completely disabled, but repurposed by just not viewing the Cut and Copy buttons, or any other ones that may reveal its value one way or another. The ones that usually remain are Paste, Select All, and Auto Fill.

  5. self-assigned this
    on Nov 21, 2018
  6. justinmc commented on Nov 21, 2018

    @justinmc
    Contributor

    @blucell Would you mind creating a new issue for these specific menu items? Looking into it, it seems like there has already been some desire for improved long press menu controls. This will give us some more reason to push for getting that right.

    Meanwhile, I'll get the above PR over the finish line to at least fix the basic problem in this issue. We're currently in code freeze for the Flutter Live event, but I should be able to merge that right afterwards (December 10th or so).

  7. justinmc commented on Dec 13, 2018

    @justinmc
    Contributor

    Alright the quicker fix is shipped. Thanks for opening the other issue. Hoping to get some time to work on the long press menu.

  8. github-actions commented on Aug 14, 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.

  9. locked as resolved and limited conversation to collaborators on Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: fidelityMatching the OEM platforms bettera: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions