Skip to content

Commit

Permalink
fix: Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
workgroupengineering committed Oct 5, 2024
1 parent b711f77 commit dcccfe7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
10 changes: 2 additions & 8 deletions src/Avalonia.Base/Input/AccessKeyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <see cref="Platform.KeyGestureFormatInfo.FormatKey"/>
/// can be use <see cref="KeyEventArgs.KeySymbol"/>
/// but <see cref="Platform.KeyGestureFormatInfo.FormatKey"/>
/// 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
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 0 additions & 5 deletions src/Avalonia.Base/Input/IMainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ internal interface IMainMenu
/// </summary>
void Open();

/// <summary>
/// Indicating whether the menu is Visible
/// </summary>
bool IsVisible { get; }

/// <summary>
/// Occurs when the main menu closes.
/// </summary>
Expand Down

0 comments on commit dcccfe7

Please sign in to comment.