fix: a blind player can bind keys, build a consist and read the tapes

A review against WCAG 2.2 AA left places a screen reader user could not work:

- Key bindings: a key's button says the command and the key, the clear button
  which command it clears; a new key is said aloud and focus comes back to its
  row. The on-screen keyboard is reached with Tab and walked with the arrows.
- Number fields read their label; the spin buttons are named and left out of Tab.
- Dialogs: Enter presses the main button, Esc closes, focus starts on the first
  button and the message is read with it.
- Consist: every change is said - added, removed, turned, moved, replaced,
  undone - and the strip is a named list; a turned card says so.
- Searches say how many entries are left once typing pauses.
- Hasler tapes, the black box timeline, timetable and cab panel take focus, work
  from the keyboard, read their value as it changes and draw a focus frame.
- Section reset and level controls, the crew button and the tabs carry names;
  English names from Avalonia's templates are read in the starter's language;
  sort and crew menus are radio items.
- Input borders reach 3:1 against the panels; Tab starts at the top bar; the
  splash screen has a title and its progress reads the loading step.
This commit is contained in:
maj00r
2026-11-15 20:46:55 +01:00
parent 07bd3d27fb
commit ff5228555e
43 changed files with 1419 additions and 45 deletions

View File

@@ -1326,8 +1326,15 @@ public partial class Settings : UserControl, ISettingsCapture
return;
ApplyFilter();
_searchResults ??= new SearchResultsTeller(SettingsSearch, () => _shownCount);
_searchResults.Changed();
}
private SearchResultsTeller? _searchResults;
// How many settings - or key bindings - the last filter left on the screen.
private int _shownCount;
/// <summary>
/// Single owner of what is on screen. With an empty query it shows the selected
/// category; with a query it stacks every category and keeps only the rows that
@@ -1350,11 +1357,13 @@ public partial class Settings : UserControl, ISettingsCapture
if (bindings)
{
_keyBindings.RebuildList();
_shownCount = _keyBindings.ShownCount;
foreach (var entry in CategoryList.Items.OfType<ListBoxItem>())
entry.Classes.Set("NoHits", false);
return;
}
_shownCount = 0;
foreach (var panel in SettingsStack.Children.OfType<StackPanel>())
{
bool anyRow = false;
@@ -1369,6 +1378,8 @@ public partial class Settings : UserControl, ISettingsCapture
(!searching || TextMatch.Contains(RowSearchText(row), query));
row.IsVisible = visible;
anyInSection |= visible;
if (visible && searching)
_shownCount++;
}
section.IsVisible = anyInSection;