From e5ecc5080b4fe5e32d43007c8d86de2d08beeb1a Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 3 Oct 2026 17:24:28 +0000 Subject: [PATCH] fix(setup): announce the "Remove my data" plan when it appears Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- src/Titano.Setup/Views/SetupViewModel.cs | 1 + src/Titano.Setup/Views/SetupWindow.xaml | 2 +- src/Titano.Setup/Views/SetupWindow.xaml.cs | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Titano.Setup/Views/SetupViewModel.cs b/src/Titano.Setup/Views/SetupViewModel.cs index d8b0d190..8cc1b642 100644 --- a/src/Titano.Setup/Views/SetupViewModel.cs +++ b/src/Titano.Setup/Views/SetupViewModel.cs @@ -245,6 +245,7 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo public bool HasLaunchOption => _engine?.LaunchTarget(SelectedComponents) is not null; public string InstallText => CanChangeLocation ? Loc.L("Setup.Action.Install") : Loc.L("Setup.Action.Update"); + /// What Install does, or why it is disabled: no program selected, or a folder it cannot use. public string InstallToolTip => !Components.Any(c => c.IsSelected) ? Loc.L("Tooltips.Setup.NoComponent") : !IsDirectoryValid ? Loc.L("Tooltips.Setup.FolderInvalid") diff --git a/src/Titano.Setup/Views/SetupWindow.xaml b/src/Titano.Setup/Views/SetupWindow.xaml index 467ddbf3..e7a794fb 100644 --- a/src/Titano.Setup/Views/SetupWindow.xaml +++ b/src/Titano.Setup/Views/SetupWindow.xaml @@ -102,7 +102,7 @@ - diff --git a/src/Titano.Setup/Views/SetupWindow.xaml.cs b/src/Titano.Setup/Views/SetupWindow.xaml.cs index 8cf8e360..17a292d2 100644 --- a/src/Titano.Setup/Views/SetupWindow.xaml.cs +++ b/src/Titano.Setup/Views/SetupWindow.xaml.cs @@ -59,19 +59,29 @@ internal sealed partial class SetupWindow : TitanoWindow e.Handled = true; } - /// A new stage collapses the focused button: the keyboard moves to the new default and the outcome is read out. + /// + /// A new stage collapses the focused button: the keyboard moves to the new default and the outcome is read out. + /// The "Remove my data" plan is read out when it appears. + /// private void OnModelChanged(object? sender, PropertyChangedEventArgs e) { + if (e.PropertyName == nameof(SetupViewModel.IsDataPlanVisible) && _model.IsDataPlanVisible) + Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () => Announce(DataPlanHeading)); if (_model.Stage == _shownStage) return; _shownStage = _model.Stage; Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () => { FocusDefault(); - if (StageMessage() is { IsVisible: true } message) - UIElementAutomationPeer.CreatePeerForElement(message)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged); + if (StageMessage() is { } message) Announce(message); }); } + /// Asks screen readers to read (it carries a live setting). + private static void Announce(UIElement element) + { + if (element.IsVisible) UIElementAutomationPeer.CreatePeerForElement(element)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged); + } + private TextBlock? StageMessage() => _model.Stage switch { SetupStage.Confirm => ConfirmMessage,