From ace7787526c412e112e60f03aa82b2b5e20ddd09 Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Fri, 15 Jul 2022 14:16:25 +0200 Subject: [PATCH] Fix arrow left on all-disabled submenu closing menu --- .../Platform/DefaultMenuInteractionHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs index ce1cddc8cd..16aeb2f559 100644 --- a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs +++ b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs @@ -175,7 +175,11 @@ namespace Avalonia.Controls.Platform case Key.Left: { - if (item?.Parent is IMenuItem parent && !parent.IsTopLevel && parent.IsSubMenuOpen) + if (item is { IsSubMenuOpen: true, SelectedItem: null }) + { + item.Close(); + } + else if (item?.Parent is IMenuItem { IsTopLevel: false, IsSubMenuOpen: true } parent) { parent.Close(); parent.Focus();