mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-23 16:39:12 +01:00
NVDA read icon buttons as "Material.Icons.Avalonia.MaterialIcon" and the sceneries in the tree as nothing. Icon buttons are now named by their tooltip, list and tree entries by the text they show, fields by the hint in them, and the inputs of a setting row by its label. The lists, the tree and the language and profile pickers have names, and a consist card says its place and vehicles. Adding a vehicle rebuilt the browser list and switched the add button off for a moment, and focus fell out of the window: Tab did nothing until something was clicked. Focus goes back to the button or the list, and Tab with nothing focused starts from the first control. The splitters are no longer Tab stops.
25 lines
979 B
C#
25 lines
979 B
C#
using System;
|
|
using Avalonia.Input;
|
|
|
|
namespace StarterNG.Controls;
|
|
|
|
public static class KeyboardFocus
|
|
{
|
|
/// <summary>
|
|
/// Focus that fell out with a control taken away or switched off leaves the window
|
|
/// itself focused, and Tab then went nowhere until something was clicked - for
|
|
/// someone without a mouse, nowhere at all. Tab starts again from the first
|
|
/// control, Shift+Tab from the last. Null when focus is somewhere and Tab moves it
|
|
/// as usual.
|
|
/// </summary>
|
|
public static IInputElement? TabFromNowhere(Key key, KeyModifiers modifiers, IInputElement? focused,
|
|
IInputElement window, Func<IInputElement?> first,
|
|
Func<IInputElement?> last)
|
|
{
|
|
if (key != Key.Tab || focused is not null && !ReferenceEquals(focused, window))
|
|
return null;
|
|
|
|
return modifiers.HasFlag(KeyModifiers.Shift) ? last() : first();
|
|
}
|
|
}
|