Add tab navigation to Editor context menus and popups

#3676
This commit is contained in:
Wojtek Figat
2026-01-30 17:50:24 +01:00
parent 6b36543717
commit e8c2f18a4d

View File

@@ -108,6 +108,11 @@ namespace FlaxEditor.GUI.ContextMenu
/// </summary>
public bool UseInput = true;
/// <summary>
/// Optional flag that can disable UI navigation (tab/enter).
/// </summary>
public bool UseNavigation = true;
/// <summary>
/// Initializes a new instance of the <see cref="ContextMenuBase"/> class.
/// </summary>
@@ -594,6 +599,21 @@ namespace FlaxEditor.GUI.ContextMenu
case KeyboardKeys.Escape:
Hide();
return true;
case KeyboardKeys.Return:
if (UseNavigation && Root?.FocusedControl != null)
{
Root.SubmitFocused();
return true;
}
break;
case KeyboardKeys.Tab:
if (UseNavigation && Root != null)
{
bool shiftDown = Root.GetKey(KeyboardKeys.Shift);
Root.Navigate(shiftDown ? NavDirection.Previous : NavDirection.Next);
return true;
}
break;
}
return false;
}