Skip to content

Autocomplete don't hide options when keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag on desktop #150048

@adonisRodxander

Description

@adonisRodxander

Steps to reproduce

  1. Run the minimal reproducible sample in web/android

Expected results

The options list should be hidden when scrolling.

It works fine on Android, but not on the web.

Actual results

Autocomplete keeps showing the options list

Code sample

Code sample
import 'package:flutter/material.dart';

void main() => runApp(const AutocompleteExampleApp());

class AutocompleteExampleApp extends StatelessWidget {
  const AutocompleteExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Autocomplete'),
        ),
        body: SingleChildScrollView(
          keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ...List.generate(
                10,
                (index) => Text(index.toString()),
              ),
              Autocomplete<String>(
                optionsBuilder: (TextEditingValue textEditingValue) {
                  return [
                    'aardvark',
                    'bobcat',
                    'chameleon',
                  ];
                },
              ),
              ...List.generate(
                30,
                (index) => Text(index.toString()),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Mobile
Screencast.from.11-06-24.11.40.28.webm
Web
Screencast.from.11-06-24.11.43.15.webm

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output master/stable

master

[✓] Flutter (Channel master, 3.23.0-13.0.pre.168, on Ubuntu 22.04.4 LTS 6.5.0-35-generic, locale en_US.UTF-8)
    • Flutter version 3.23.0-13.0.pre.168 on channel master at /home/user/fvm/versions/master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 32081aab69 (3 days ago), 2024-06-08 10:35:21 -0700
    • Engine revision 1cdbebee19
    • Dart version 3.5.0 (build 3.5.0-236.0.dev)
    • DevTools version 2.36.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /../
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/user/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    ✗ pkg-config is required for Linux development.
      It is likely available from your distribution (e.g.: apt install pkg-config), or can be downloaded from
      https://www.freedesktop.org/wiki/Software/pkg-config/

[✓] Android Studio (version 2023.3)
    • Android Studio at /home/user/android-studio/
    • Flutter plugin version 79.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /home/user/android-studio/
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[!] Android Studio (version unknown)
    • Android Studio at /home/user/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.90.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.86.0

[✓] Connected device (3 available)
    • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64    • Android 6.0 (API 23) (emulator)
    • Linux (desktop)                       • linux         • linux-x64      • Ubuntu 22.04.4 LTS 6.5.0-35-generic
    • Chrome (web)                          • chrome        • web-javascript • Google Chrome 125.0.6422.141

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

stable

[✓] Flutter (Channel stable, 3.22.0, on Ubuntu 22.04.4 LTS 6.5.0-35-generic, locale en_US.UTF-8)
    • Flutter version 3.22.0 on channel stable at /home/user/fvm/versions/3.22.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (5 weeks ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at //
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/user/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    ✗ pkg-config is required for Linux development.
      It is likely available from your distribution (e.g.: apt install pkg-config), or can be downloaded from
      https://www.freedesktop.org/wiki/Software/pkg-config/

[✓] Android Studio (version 2023.3)
    • Android Studio at /home/user/android-studio/
    • Flutter plugin version 79.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /home/user/android-studio/
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[!] Android Studio (version unknown)
    • Android Studio at /home/user/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.90.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.86.0

[✓] Connected device (3 available)
    • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64    • Android 6.0 (API 23) (emulator)
    • Linux (desktop)                       • linux         • linux-x64      • Ubuntu 22.04.4 LTS 6.5.0-35-generic
    • Chrome (web)                          • chrome        • web-javascript • Google Chrome 125.0.6422.141

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsf: scrollingViewports, list views, slivers, etc.found in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions