Skip to content

DropdownMenu menu panel does not close when pressing ESC and requestFocusOnTap is false #177993

@bleroux

Description

@bleroux

Steps to reproduce

  1. Run the code sample.
  2. Tap on the DropdownMenu to open the menu panel.
  3. Press ESC key on a physical keyboard.

Expected results

The menu panel closes.

Actual results

The menu panel remains open.

Code sample

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

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

final List<DropdownMenuEntry<int>> entries = List.generate(
  6,
  (int i) => DropdownMenuEntry(value: i * 200, label: '${i * 200}'),
);

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(title: 'DropdownMenu ESC repro', home: HomePage());
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Center(
        child: DropdownMenu(
          initialSelection: 500,
          dropdownMenuEntries: entries,
          requestFocusOnTap: false,
          textInputAction: TextInputAction.next,
          label: const Text('DropdownMenu'),
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
Flutter (Channel master, 3.38.0-1.0.pre-409, on macOS 15.6.1 24G90 darwin-arm64, locale en-FR)

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.35Found to occur in 3.35found in release: 3.38Found to occur in 3.38frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions