diff --git a/packages/flutter/lib/src/material/menu_anchor.dart b/packages/flutter/lib/src/material/menu_anchor.dart index 524d8970ca..140e11a2de 100644 --- a/packages/flutter/lib/src/material/menu_anchor.dart +++ b/packages/flutter/lib/src/material/menu_anchor.dart @@ -544,14 +544,6 @@ _MenuAnchorState? get _previousFocusableSibling { } } - KeyEventResult _checkForEscape(KeyEvent event) { - if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.escape) { - _close(); - return KeyEventResult.handled; - } - return KeyEventResult.ignored; - } - /// Open the menu, optionally at a position relative to the [MenuAnchor]. /// /// Call this when the menu should be shown to the user. @@ -592,9 +584,6 @@ _MenuAnchorState? get _previousFocusableSibling { if (!_isOpen) { return; } - if (_isRoot) { - FocusManager.instance.removeEarlyKeyEventHandler(_checkForEscape); - } _closeChildren(inDispose: inDispose); // Don't hide if we're in the middle of a build. if (SchedulerBinding.instance.schedulerPhase != SchedulerPhase.persistentCallbacks) {