diff --git a/src/Titano.App/Sections/JobsViewModel.cs b/src/Titano.App/Sections/JobsViewModel.cs
index 3a7ab09a..393f156f 100644
--- a/src/Titano.App/Sections/JobsViewModel.cs
+++ b/src/Titano.App/Sections/JobsViewModel.cs
@@ -262,7 +262,7 @@ public sealed class JobsViewModel : SectionViewModel
private void UpdateShell()
{
if (_model.Current is { } current)
- Shell.SetJob(JobText.Bar(current), current.Fraction ?? 0, indeterminate: current.Fraction is null);
+ Shell.SetJob(JobText.Bar(current), current.Fraction ?? 0, indeterminate: current.Fraction is null, name: JobText.Name(current.Job));
else
Shell.SetJob(null, 0);
// The rail badge, the status strip and the Running chip count the same jobs: running or paused (Jobs.html).
diff --git a/src/Titano.App/Shell/MainWindow.xaml b/src/Titano.App/Shell/MainWindow.xaml
index a27115d2..d0fc17d4 100644
--- a/src/Titano.App/Shell/MainWindow.xaml
+++ b/src/Titano.App/Shell/MainWindow.xaml
@@ -4,6 +4,7 @@
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
xmlns:shell="clr-namespace:Titano.App.Shell"
+ xmlns:infra="clr-namespace:Titano.App.Infrastructure"
xmlns:s="clr-namespace:Titano.App.Sections"
Title="{Binding WindowTitle}"
Width="1440" Height="900" MinWidth="1200" MinHeight="760"
@@ -63,10 +64,12 @@
-
-
+
+ Visibility="{Binding IsJobBarVisible, Converter={StaticResource BoolToVisibility}}"
+ AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding JobAnnouncement}" />
@@ -76,7 +79,8 @@
-
+
diff --git a/src/Titano.App/Shell/ShellViewModel.cs b/src/Titano.App/Shell/ShellViewModel.cs
index de982d4a..6a68c0e3 100644
--- a/src/Titano.App/Shell/ShellViewModel.cs
+++ b/src/Titano.App/Shell/ShellViewModel.cs
@@ -16,6 +16,7 @@ public sealed class ShellViewModel : LocalizedViewModel
private SectionViewModel _current;
private bool _isRailCollapsed;
private string? _jobText;
+ private string? _jobName;
private double _jobProgress;
private bool _jobActive;
private bool _jobIndeterminate;
@@ -184,14 +185,25 @@ public sealed class ShellViewModel : LocalizedViewModel
/// Pauses the job the bar shows.
public ICommand? StopJobCommand => Jobs.PauseCurrentCommand;
- /// Updates the global job bar (and the taskbar progress through the window).
- public void SetJob(string? text, double progress, bool indeterminate = false)
+ ///
+ /// What screen readers hear from the job bar: the job when one starts, the idle line when the last one ends; not its
+ /// progress, speed or time left, which change every second.
+ ///
+ public string JobAnnouncement => _jobActive && _jobName is not null ? _jobName : JobText;
+
+ ///
+ /// Updates the global job bar (and the taskbar progress through the window). says which job
+ /// it is without its progress ("Render: Harbour sunset"); null reads .
+ ///
+ public void SetJob(string? text, double progress, bool indeterminate = false, string? name = null)
{
_jobText = text;
+ _jobName = text is null ? null : name ?? text;
IsJobActive = text is not null;
JobProgress = progress;
IsJobIndeterminate = indeterminate;
OnPropertyChanged(nameof(JobText));
+ OnPropertyChanged(nameof(JobAnnouncement));
}
// ---- Status strip ----
@@ -227,6 +239,7 @@ public sealed class ShellViewModel : LocalizedViewModel
_queuedCount = queued;
OnPropertyChanged(nameof(JobsText));
OnPropertyChanged(nameof(JobText));
+ OnPropertyChanged(nameof(JobAnnouncement));
}
public void Navigate(SectionKey key)
@@ -262,6 +275,7 @@ public sealed class ShellViewModel : LocalizedViewModel
ShowToast(new Toast
{
Title = ErrorText.For(ex),
+ IsError = true,
ActionText = Loc.L("Common.OpenLogs"),
ActionToolTip = Loc.L("Tooltips.Common.OpenLogs"),
ActionCommand = new RelayCommand(() => ShellActions.Reveal(Services.Environment.LogDirectory)),
diff --git a/src/Titano.Ui/Controls/JobBar.cs b/src/Titano.Ui/Controls/JobBar.cs
index ddfd770c..78400593 100644
--- a/src/Titano.Ui/Controls/JobBar.cs
+++ b/src/Titano.Ui/Controls/JobBar.cs
@@ -1,10 +1,15 @@
using System.Windows;
+using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Input;
namespace Titano.Ui.Controls;
-/// 40-px strip under the title bar: current job, progress, time left and a stop (or pause) button (DESIGN §4).
+///
+/// 40-px strip under the title bar: current job, progress, time left and a stop (or pause) button (DESIGN §4). Screen
+/// readers see a status bar; its name is AutomationProperties.Name (the owner keeps it to the job's state, so
+/// it can be a live region that does not speak every progress tick), else .
+///
public class JobBar : Control
{
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(JobBar));
@@ -39,4 +44,20 @@ public class JobBar : Control
/// Glyph of the action button: stop by default; the client shows pause (DESIGN §4 job bar).
public IconData? ActionGlyph { get => (IconData?)GetValue(ActionGlyphProperty); set => SetValue(ActionGlyphProperty, value); }
+
+ protected override AutomationPeer OnCreateAutomationPeer() => new JobBarAutomationPeer(this);
+}
+
+/// The job bar seen by UI Automation: a status bar holding the progress bar and the pause button.
+public sealed class JobBarAutomationPeer(JobBar owner) : FrameworkElementAutomationPeer(owner)
+{
+ protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.StatusBar;
+
+ protected override string GetClassNameCore() => nameof(JobBar);
+
+ protected override string GetNameCore()
+ {
+ var name = base.GetNameCore();
+ return string.IsNullOrEmpty(name) ? ((JobBar)Owner).Text ?? string.Empty : name;
+ }
}
diff --git a/src/Titano.Ui/Controls/Toasts.cs b/src/Titano.Ui/Controls/Toasts.cs
index 75701caa..16f8c33c 100644
--- a/src/Titano.Ui/Controls/Toasts.cs
+++ b/src/Titano.Ui/Controls/Toasts.cs
@@ -19,6 +19,9 @@ public sealed class Toast : ObservableObject
public ICommand? ActionCommand { get; init; }
public string? ActionToolTip { get; init; }
public TimeSpan Lifetime { get; init; } = TimeSpan.FromSeconds(8);
+
+ /// Something failed: screen readers say it at once, ahead of other notices (assertive, not polite).
+ public bool IsError { get; init; }
}
///
@@ -131,10 +134,15 @@ public class ToastHost : ItemsControl
Dispatcher.BeginInvoke(() => Dismiss(toast));
}
+ ///
+ /// A UI Automation notification rather than a live region: a toast is a new element, not a text that changes, and
+ /// the host's peer is always in the tree. Notices queue (polite); errors interrupt (assertive).
+ ///
private void Announce(Toast toast)
{
var text = string.IsNullOrEmpty(toast.Message) ? toast.Title : toast.Title + " " + toast.Message;
UIElementAutomationPeer.CreatePeerForElement(this)?.RaiseNotificationEvent(
- AutomationNotificationKind.Other, AutomationNotificationProcessing.ImportantMostRecent, text, "Titano.Toast");
+ AutomationNotificationKind.Other, toast.IsError ? AutomationNotificationProcessing.ImportantAll : AutomationNotificationProcessing.All,
+ text, "Titano.Toast");
}
}