diff --git a/src/Avalonia.Base/Input/AccessKeyHandler.cs b/src/Avalonia.Base/Input/AccessKeyHandler.cs index 98e4c743919..58b2b6a8fcd 100644 --- a/src/Avalonia.Base/Input/AccessKeyHandler.cs +++ b/src/Avalonia.Base/Input/AccessKeyHandler.cs @@ -181,13 +181,7 @@ protected virtual void OnKeyDown(object? sender, KeyEventArgs e) // If any other key is pressed with the Alt key held down, or the main menu is open, // find all controls who have registered that access key. - /// Instead of - /// can be use - /// but - /// it might allow the developer to extend the behavior in the future. - var text = - Platform.KeyGestureFormatInfo.GetInstance(System.Globalization.CultureInfo.CurrentUICulture) - .FormatKey(e.Key); + var text = e.KeySymbol; var matches = _registered .Where(x => string.Equals(x.AccessKey, text, StringComparison.OrdinalIgnoreCase) && x.Element.IsEffectivelyVisible @@ -231,7 +225,7 @@ protected virtual void OnPreviewKeyUp(object? sender, KeyEventArgs e) { MainMenu.Open(); } - if (MainMenu is null || !MainMenu.IsVisible) + if (MainMenu is null) { _owner!.ShowAccessKeys = _showingAccessKeys = false; } diff --git a/src/Avalonia.Base/Input/IMainMenu.cs b/src/Avalonia.Base/Input/IMainMenu.cs index 75f6f61eab7..02437b63676 100644 --- a/src/Avalonia.Base/Input/IMainMenu.cs +++ b/src/Avalonia.Base/Input/IMainMenu.cs @@ -23,11 +23,6 @@ internal interface IMainMenu /// void Open(); - /// - /// Indicating whether the menu is Visible - /// - bool IsVisible { get; } - /// /// Occurs when the main menu closes. ///