Browse Source

Don't handle tab navigation in DefaultMenuInteractionHandler.

Allow the default keyboard interaction handler to handle tab key presses in menus, because the logic in `DefaultMenuInteractionHandler` was causing the focus to get stuck in the menu.

Also fix `NavigationDirection.IsDirectional` method.

Fixes #5002.
pull/5094/head
Steven Kirk 6 years ago
parent
commit
4aa013a79e
  1. 2
      src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
  2. 2
      src/Avalonia.Input/NavigationDirection.cs

2
src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs

@ -231,7 +231,7 @@ namespace Avalonia.Controls.Platform
{ {
var direction = e.Key.ToNavigationDirection(); var direction = e.Key.ToNavigationDirection();
if (direction.HasValue) if (direction?.IsDirectional() == true)
{ {
if (item == null && _isContextMenu) if (item == null && _isContextMenu)
{ {

2
src/Avalonia.Input/NavigationDirection.cs

@ -83,7 +83,7 @@ namespace Avalonia.Input
/// </returns> /// </returns>
public static bool IsDirectional(this NavigationDirection direction) public static bool IsDirectional(this NavigationDirection direction)
{ {
return direction > NavigationDirection.Previous || return direction > NavigationDirection.Previous &&
direction <= NavigationDirection.PageDown; direction <= NavigationDirection.PageDown;
} }

Loading…
Cancel
Save