Skip to content

DropdownMenu keyboard navigation is broken when expandedInsets is set #156712

@bleroux

Description

@bleroux

Steps to reproduce

  1. Run the code sample.
  2. Tap on the dropdown in order to open the menu.
  3. Press down key.

Expected results

The first menu entry (labeled 'foo') is highlighted.

Actual results

No menu entries are highlighted.

If DropdownMenu.expandedInsets is not used the keyboard navigation works.

Code sample

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp({super.key});

  final List<DropdownMenuEntry<String>> menuEntries =
      ["foo", "bar", "green", "yellow"].map((t) => DropdownMenuEntry<String>(label: t, value: t)).toList();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: DropdownMenu<String>(
            expandedInsets: EdgeInsets.zero,
            requestFocusOnTap: true,
            dropdownMenuEntries: menuEntries,
          ),
        ),
      ),
    );
  }
}

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.24.0-1.0.pre.1340, on Ubuntu 24.04.1 LTS 6.8.0-45-generic, locale fr_FR.UTF-8)
    ! Flutter version 3.24.0-1.0.pre.1340 on channel [user-branch] at /home/bruno/Nevercode/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not the same as FLUTTER_GIT_URL

Metadata

Metadata

Assignees

Labels

f: material designflutter/packages/flutter/material repository.found in release: 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27frameworkflutter/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 team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions