Skip to content

[iOS] Textfield loses focus after 'Shake to undo' system dialog, despite keyboard reappears. #150522

Open

Description

@AlexChechetkin-LXC

Steps to reproduce

  1. There is a textfield on the screen.
  2. Type some text into it
  3. Shake iOS device
  4. System 'Shake to undo' dialog appears, keyboard disappears
  5. Make any choice in the dialog

Expected results

Expected result: Keyboard is reopened, TextField regains focus, user able to type.

Actual results

Actual result: Keyboard is reopened, TextField does not have focus, user is unable to type or to hide keyboard.

Code sample

Code sample
TextField(

)

Screenshots or Video

Screenshots / Video demonstration
RPReplay_Final1718830396.MP4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Activity

  1. changed the title [-][iOS] Textfield looses focus after 'Shake to undo' system dialog, despite keyboard reappears.[/-] [+][iOS] Textfield loses focus after 'Shake to undo' system dialog, despite keyboard reappears.[/+] on Jun 19, 2024
  2. darshankawar commented on Jun 20, 2024

    @darshankawar
    Member

    @AlexChechetkin-LXC Thanks for the report. Shake to undo feature in iOS is a TIL moment for me thanks to your issue, but it seems Flutter doesn't support yet that feature looking at #34749 which is open and hence you are seeing the reported behavior. I suggest you to follow-up in it for further updates.
    Will close this as a duplicate. If you disagree, write in comments and I'll reopen it.

  3. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Jun 20, 2024
  4. AlexChechetkin-LXC commented on Jun 24, 2024

    @AlexChechetkin-LXC
    Author

    @darshankawar, With current behavior - when textfield doesn't have a focus, but system keyboard is open and could not be closed by tapping on the empty screen space, flutter app is in inconsistent state and is broken.

    This is not a feature support request, but a bug in core component, affecting all iOS users.

  5. darshankawar commented on Jun 25, 2024

    @darshankawar
    Member

    This is not a feature support request, but a bug in core component, affecting all iOS users.

    Thanks for the feedback. Yes, I am aware that your issue report isn't a feature request, but my view was that since the linked issue is open, the shake to undo feature may not have been implemented in Flutter yet and hence the behavior you are seeing.

    But I'll reopen this issue and label this for team's attention, as I was able to replicate the reported behavior.

  6. added
    in triagePresently being triaged by the triage team
    a: text inputEntering text in a text field or keyboard related problems
    platform-iosiOS applications specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    r: duplicateIssue is closed as a duplicate of an existing issue
    on Jun 25, 2024
  7. 1 remaining item

  8. added
    fyi-iosFor the attention of iOS platform team
    and removed
    in triagePresently being triaged by the triage team
    on Jun 25, 2024
  9. justinmc commented on Jun 27, 2024

    @justinmc
    Contributor

    I think this is something that Flutter is trying to support, via UndoManager. In #34749 (comment) @Renzo-Olivares mentions that he sees an undo prompt after doing the shake gesture, but it doesn't actually undo the text. Maybe due to the field losing focus.

    This may be related to #148984 (almost ended up cherry picked but it was closed in #148976).

    @AlexChechetkin-LXC Were you on stable when you tried this? Can you try on master?

  10. added
    P2Important issues not at the top of the work list
    on Jun 27, 2024
  11. Lamda303 commented on Jul 2, 2024

    @Lamda303

    This may be related to #140508

  12. wdcs-vivekmakvana commented on Jul 10, 2024

    @wdcs-vivekmakvana

    Workaround solution : Add force stop shake to edit for iOS only. Add below code in AppDelegate.swift file.

    UIApplication.shared.applicationSupportsShakeToEdit = false

  13. AlexChechetkin-LXC commented on Nov 8, 2024

    @AlexChechetkin-LXC
    Author

    This issue is reproducible with any native dialog appearing, not just with 'shake to undo'.
    For example opening native file picker dialog (file_picker package), while textfield in focus, leads to the same inconsistent app state.

  14. chad-bekmezian-snap commented on Nov 27, 2024

    @chad-bekmezian-snap

    This really could use a fix

  15. artyom-froloff commented on Sep 29, 2026

    @artyom-froloff

    Still reproducible on Flutter 3.38.3 (stable). Workaround: on iOS when primary focus leaves every EditableText send TextInput.clearClient + TextInput.hide via SystemChannels.textInput

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 problemsfound in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyteam-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