Skip to content

ScrollView.keyboardDismissBehavior doesn't unfocus the keyboard properly #103544

Closed

Description

@Shawn-sudo

Steps to Reproduce

  1. Put keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag in a SingleChildScrollView, which has TextField among the children.
  2. Tap on the TextField to focus on it.
  3. Dismiss the keyboard by scrolling the page
  4. Open the drawer

Expected results:
When the drawer is opened, keyboard stays there

Actual results:
Keyboard pops out

IMG_4871.mp4

Similar Issue
#54277: This gives the solution to dismiss the keyboard properly, and I think the proper way of dismissing it is not applied on SingleChildScrollView's .onDrag code.

Code sample
    return Scaffold(
      appBar: AppBar(),
      drawer: Drawer(),
      body: SingleChildScrollView(
        keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
        child: SafeArea(
          child: Column(
            children: [
              TextFormField(),
            ],
          ),
        ),
      ),
    );
Logs

Activity

  1. darshankawar commented on May 12, 2022

    @darshankawar
    Member

    @Shawn-sudo
    Thanks for the report. Running your code sample on latest stable (3.0), I observed that when textfield is in focus, the keyboard opens as below:

    Screenshot 2022-05-12 at 6 09 42 PM

    And when we open drawer, the textfield becomes inactive as you can see in the background, it has greyed out and hence the keyboard closes.

    Screenshot 2022-05-12 at 6 09 53 PM

    which I think is an expected behavior. What exactly should be the expected result from your end ? Does the same occur in native iOS app if you could check and confirm ?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 12, 2022
  3. Shawn-sudo commented on May 13, 2022

    @Shawn-sudo
    Author

    @darshankawar Oh did you scroll the page before opening the drawer? Cause it happened to me only when I 1. open the keyboard 2. close the keyboard by scrolling the SingleChildScrollView (which has keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag) 3. And then open the drawer

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 13, 2022
  5. darshankawar commented on May 13, 2022

    @darshankawar
    Member

    I can't scroll using the code sample you provided. Please provide complete code sample that shows the behavior.

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 13, 2022
  7. Shawn-sudo commented on May 13, 2022

    @Shawn-sudo
    Author

    Umm Just put Column under the SingleChildScrollView add a bunch of SizedBox(height: 10000) under the Column.

  8. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 13, 2022
  9. darshankawar commented on May 13, 2022

    @darshankawar
    Member

    See if this issue is similar to your case #57609

  10. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 13, 2022
  11. Shawn-sudo commented on May 13, 2022

    @Shawn-sudo
    Author

    I think #57609 is different from what I'm talking about, but I think it would solve this issue in a broad way. Thx

  12. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 13, 2022
  13. added
    r: solvedIssue is closed as solved
    and removed
    in triagePresently being triaged by the triage team
    on May 16, 2022
  14. github-actions commented on May 30, 2022

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

  15. locked as resolved and limited conversation to collaborators on May 30, 2022
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

    r: solvedIssue is closed as solved

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions