Skip to content

Commit 7699489

Browse files
authored
uniformly apply tabability criteria AscensionGameDev#2574 (AscensionGameDev#2577)
1 parent 49f0403 commit 7699489

File tree

1 file changed

+6
-5
lines changed
  • Intersect.Client.Framework/Gwen/Control

1 file changed

+6
-5
lines changed

Intersect.Client.Framework/Gwen/Control/Base.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,9 +4144,7 @@ protected virtual bool OnKeyTab(bool down, bool shift = false)
41444144
Base? next;
41454145
lock (canvas._tabQueue)
41464146
{
4147-
var hasValid = canvas._tabQueue.Any(
4148-
control => control is { IsDisabledByTree: false, IsHiddenByTree: false }
4149-
);
4147+
var hasValid = canvas._tabQueue.Any(IsNodeValidTabTarget);
41504148
if (!hasValid)
41514149
{
41524150
return true;
@@ -4188,10 +4186,10 @@ protected virtual bool OnKeyTab(bool down, bool shift = false)
41884186
canvas._tabQueue.AddLast(next);
41894187
}
41904188
}
4191-
while (next.IsHiddenByTree || next.IsDisabledByTree || !next.IsTabable);
4189+
while (!IsNodeValidTabTarget(next));
41924190
}
41934191

4194-
if (next is { IsTabable: true, IsDisabledByTree: false, IsHiddenByTree: false })
4192+
if (IsNodeValidTabTarget(next))
41954193
{
41964194
Console.WriteLine($"Focusing {next.ParentQualifiedName} ({next.GetFullishName()})");
41974195
next.Focus(moveMouse: next is not TextBox);
@@ -4202,6 +4200,9 @@ protected virtual bool OnKeyTab(bool down, bool shift = false)
42024200
return true;
42034201
}
42044202

4203+
private static bool IsNodeValidTabTarget(Base? node) =>
4204+
node is { IsDisabledByTree: false, IsHiddenByTree: false, IsTabable: true };
4205+
42054206
/// <summary>
42064207
/// Handler for Space keyboard event.
42074208
/// </summary>

0 commit comments

Comments
 (0)