fix(app): the job bar and the connection state are live regions; error toasts interrupt
- The job bar is a status bar for screen readers; it announces which job starts and when the queue empties (ShellViewModel.JobAnnouncement), never its progress ticks. - The status strip's connection text announces a change of server state. - Toast.IsError: error notices are announced at once; other notices queue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
5 files changed
+56
-9
No files matched your search
@@ -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);
|
||||
|
||||
/// <summary>Something failed: screen readers say it at once, ahead of other notices (assertive, not polite).</summary>
|
||||
public bool IsError { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -131,10 +134,15 @@ public class ToastHost : ItemsControl
|
||||
Dispatcher.BeginInvoke(() => Dismiss(toast));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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).
|
||||
/// </summary>
|
||||
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");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user