fix(setup): announce the "Remove my data" plan when it appears
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
3 files changed
+15
-4
No files matched your search
@@ -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");
|
||||
|
||||
/// <summary>What Install does, or why it is disabled: no program selected, or a folder it cannot use.</summary>
|
||||
public string InstallToolTip => !Components.Any(c => c.IsSelected) ? Loc.L("Tooltips.Setup.NoComponent")
|
||||
: !IsDirectoryValid ? Loc.L("Tooltips.Setup.FolderInvalid")
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<Border Grid.Row="2" Grid.Column="1" Style="{StaticResource Border.Card}" Padding="12,8"
|
||||
Visibility="{Binding IsDataPlanVisible, Converter={StaticResource BoolToVisibility}}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding DataPlanText}" Style="{StaticResource Text.Section}" Foreground="{DynamicResource Brush.Warning}" Margin="0,0,0,6"
|
||||
<TextBlock x:Name="DataPlanHeading" Text="{Binding DataPlanText}" Style="{StaticResource Text.Section}" Foreground="{DynamicResource Brush.Warning}" Margin="0,0,0,6"
|
||||
AutomationProperties.LiveSetting="Polite" />
|
||||
<ItemsControl ItemsSource="{Binding DataPlanRows}" Focusable="False">
|
||||
<ItemsControl.ItemTemplate>
|
||||
|
||||
@@ -59,19 +59,29 @@ internal sealed partial class SetupWindow : TitanoWindow
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>A new stage collapses the focused button: the keyboard moves to the new default and the outcome is read out.</summary>
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Asks screen readers to read <paramref name="element"/> (it carries a live setting).</summary>
|
||||
private static void Announce(UIElement element)
|
||||
{
|
||||
if (element.IsVisible) UIElementAutomationPeer.CreatePeerForElement(element)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
|
||||
}
|
||||
|
||||
private TextBlock? StageMessage() => _model.Stage switch
|
||||
{
|
||||
SetupStage.Confirm => ConfirmMessage,
|
||||
|
||||
Reference in new issue
Block a user