Skip to content

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

@Shawn-sudo

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

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