Skip to content

[DropdownMenu] Keyboard not closing when clicking on done with requestFocusOnTap: true on mobiles #177009

@Gustl22

Description

@Gustl22

Steps to reproduce

  1. Run the code example below on a mobile device (iOS or Android)
  2. Write something in the Textfield -> done -> Keyboard closes
  3. Write something in the Drowdown field -> done -> Keybaord should close, but does not

Tipp: to enable the virtual keyboard on iOS simulator hit: I/O -> keyboard -> Toggle Software Keyboard

Expected results

The keyboard should close when clicking on done.

Actual results

The keyboard keeps open when clicking on done.

Code sample

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

void main() {
  runApp(const DropdownMenuExample());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(colorSchemeSeed: Colors.green),
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            spacing: 20,
            children: [
              TextField(
                decoration: InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: 'TextField can close keyboard',
                ),
              ),
              DropdownMenu<String>(
                label: Text('Dropdown with filter cannot close keyboard'),
                initialSelection: 'green',
                requestFocusOnTap: true,
                onSelected: (String? color) {},
                dropdownMenuEntries: [
                  DropdownMenuEntry(value: 'red', label: 'red'),
                  DropdownMenuEntry(value: 'green', label: 'green'),
                  DropdownMenuEntry(value: 'blue', label: 'blue')
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration Image Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.6, on macOS 15.7 24G222 darwin-arm64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 26.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2025.1.1.1)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions