Skip to content

Commit dad6d45

Browse files
aksOpsclaude
andcommitted
a11y: label every icon button; drop dead Mica call
- Add AutomationProperties.Name to all 16 Button / ToggleButton controls across the preview window and floating widget so screen readers announce semantic labels (e.g. "Zoom in", "Highlight tool", "Pin window on top") instead of Segoe Fluent Icon codepoints or empty strings for icon-only buttons. - Replace the Set-MicaBackdrop call on the preview window with an explanatory comment. DwmSetWindowAttribute(DWMSBT_MAINWINDOW) is a silent no-op on windows declared AllowsTransparency="True", so this call was never producing any visual change. Keep the helper function for future opaque windows. Validated by parsing SnipIT.ps1 through the PowerShell AST and all four embedded XAML blocks through [xml] in this session. Headless suite: 72/72 still passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2c29d3e commit dad6d45

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

SnipIT.ps1

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -858,16 +858,16 @@ function Show-PreviewWindow {
858858
VerticalAlignment="Center" FontSize="12" Text="100%"/>
859859
</StackPanel>
860860
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
861-
<Button x:Name="ZoomOutBtn" Width="32" Height="28" Padding="0" Margin="0,0,4,0" ToolTip="Zoom out (Ctrl + -)">
861+
<Button x:Name="ZoomOutBtn" AutomationProperties.Name="Zoom out" Width="32" Height="28" Padding="0" Margin="0,0,4,0" ToolTip="Zoom out (Ctrl + -)">
862862
<TextBlock Text="&#xE71F;" FontFamily="Segoe Fluent Icons" FontSize="14"/>
863863
</Button>
864-
<Button x:Name="FitBtn" Width="40" Height="28" Padding="0" Margin="0,0,4,0" ToolTip="Fit (Ctrl + 0)">
864+
<Button x:Name="FitBtn" AutomationProperties.Name="Fit to viewport" Width="40" Height="28" Padding="0" Margin="0,0,4,0" ToolTip="Fit (Ctrl + 0)">
865865
<TextBlock Text="Fit" FontSize="12"/>
866866
</Button>
867-
<Button x:Name="ZoomInBtn" Width="32" Height="28" Padding="0" Margin="0,0,10,0" ToolTip="Zoom in (Ctrl + +)">
867+
<Button x:Name="ZoomInBtn" AutomationProperties.Name="Zoom in" Width="32" Height="28" Padding="0" Margin="0,0,10,0" ToolTip="Zoom in (Ctrl + +)">
868868
<TextBlock Text="&#xE710;" FontFamily="Segoe Fluent Icons" FontSize="14"/>
869869
</Button>
870-
<ToggleButton x:Name="PinBtn" Width="36" Height="28" Padding="0" ToolTip="Always on top">
870+
<ToggleButton x:Name="PinBtn" AutomationProperties.Name="Pin window on top" Width="36" Height="28" Padding="0" ToolTip="Always on top">
871871
<TextBlock Text="&#xE718;" FontFamily="Segoe Fluent Icons" FontSize="14"/>
872872
</ToggleButton>
873873
</StackPanel>
@@ -889,44 +889,44 @@ function Show-PreviewWindow {
889889
<!-- Annotation toolbar row -->
890890
<Border Grid.Row="2" Padding="16,8,16,4" Background="#22000000">
891891
<DockPanel LastChildFill="False">
892-
<ToggleButton x:Name="HighlightBtn" DockPanel.Dock="Left" MinWidth="108" Margin="0,0,4,0" Padding="10,6" ToolTip="Highlight (filled)">
892+
<ToggleButton x:Name="HighlightBtn" AutomationProperties.Name="Highlight tool" DockPanel.Dock="Left" MinWidth="108" Margin="0,0,4,0" Padding="10,6" ToolTip="Highlight (filled)">
893893
<StackPanel Orientation="Horizontal">
894894
<TextBlock Text="&#xE7E6;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
895895
<TextBlock Text="Highlight"/>
896896
</StackPanel>
897897
</ToggleButton>
898-
<ToggleButton x:Name="RectBtn" DockPanel.Dock="Left" MinWidth="82" Margin="0,0,4,0" Padding="10,6" ToolTip="Rectangle outline">
898+
<ToggleButton x:Name="RectBtn" AutomationProperties.Name="Rectangle tool" DockPanel.Dock="Left" MinWidth="82" Margin="0,0,4,0" Padding="10,6" ToolTip="Rectangle outline">
899899
<StackPanel Orientation="Horizontal">
900900
<TextBlock Text="&#xE739;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
901901
<TextBlock Text="Rect"/>
902902
</StackPanel>
903903
</ToggleButton>
904-
<ToggleButton x:Name="ArrowBtn" DockPanel.Dock="Left" MinWidth="86" Margin="0,0,4,0" Padding="10,6" ToolTip="Arrow">
904+
<ToggleButton x:Name="ArrowBtn" AutomationProperties.Name="Arrow tool" DockPanel.Dock="Left" MinWidth="86" Margin="0,0,4,0" Padding="10,6" ToolTip="Arrow">
905905
<StackPanel Orientation="Horizontal">
906906
<TextBlock Text="&#xE72A;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
907907
<TextBlock Text="Arrow"/>
908908
</StackPanel>
909909
</ToggleButton>
910-
<ToggleButton x:Name="TextBtn" DockPanel.Dock="Left" MinWidth="82" Margin="0,0,10,0" Padding="10,6" ToolTip="Text">
910+
<ToggleButton x:Name="TextBtn" AutomationProperties.Name="Text tool" DockPanel.Dock="Left" MinWidth="82" Margin="0,0,10,0" Padding="10,6" ToolTip="Text">
911911
<StackPanel Orientation="Horizontal">
912912
<TextBlock Text="&#xE8D2;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
913913
<TextBlock Text="Text"/>
914914
</StackPanel>
915915
</ToggleButton>
916916
<StackPanel x:Name="ColorBar" Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"/>
917-
<Button x:Name="RedoBtn" DockPanel.Dock="Right" MinWidth="80" Margin="6,0,0,0" Padding="10,6" ToolTip="Redo (Ctrl+Shift+Z)">
917+
<Button x:Name="RedoBtn" AutomationProperties.Name="Redo" DockPanel.Dock="Right" MinWidth="80" Margin="6,0,0,0" Padding="10,6" ToolTip="Redo (Ctrl+Shift+Z)">
918918
<StackPanel Orientation="Horizontal">
919919
<TextBlock Text="&#xE7A6;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
920920
<TextBlock Text="Redo"/>
921921
</StackPanel>
922922
</Button>
923-
<Button x:Name="UndoBtn" DockPanel.Dock="Right" MinWidth="80" Margin="6,0,0,0" Padding="10,6" ToolTip="Undo (Ctrl+Z)">
923+
<Button x:Name="UndoBtn" AutomationProperties.Name="Undo" DockPanel.Dock="Right" MinWidth="80" Margin="6,0,0,0" Padding="10,6" ToolTip="Undo (Ctrl+Z)">
924924
<StackPanel Orientation="Horizontal">
925925
<TextBlock Text="&#xE7A7;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
926926
<TextBlock Text="Undo"/>
927927
</StackPanel>
928928
</Button>
929-
<Button x:Name="ClearBtn" DockPanel.Dock="Right" MinWidth="86" Padding="10,6">
929+
<Button x:Name="ClearBtn" AutomationProperties.Name="Clear all annotations" DockPanel.Dock="Right" MinWidth="86" Padding="10,6">
930930
<StackPanel Orientation="Horizontal">
931931
<TextBlock Text="&#xE74D;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
932932
<TextBlock Text="Clear"/>
@@ -938,25 +938,25 @@ function Show-PreviewWindow {
938938
<!-- Action button row -->
939939
<Border Grid.Row="3" Padding="16,4,16,12" Background="#22000000">
940940
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
941-
<Button x:Name="CopyBtn" MinWidth="110" Margin="0,0,8,0" Padding="14,8">
941+
<Button x:Name="CopyBtn" AutomationProperties.Name="Copy to clipboard" MinWidth="110" Margin="0,0,8,0" Padding="14,8">
942942
<StackPanel Orientation="Horizontal">
943943
<TextBlock Text="&#xE8C8;" FontFamily="Segoe Fluent Icons" Margin="0,0,8,0"/>
944944
<TextBlock Text="Copy"/>
945945
</StackPanel>
946946
</Button>
947-
<Button x:Name="SaveBtn" MinWidth="110" Margin="0,0,8,0" Padding="14,8">
947+
<Button x:Name="SaveBtn" AutomationProperties.Name="Save snip" MinWidth="110" Margin="0,0,8,0" Padding="14,8">
948948
<StackPanel Orientation="Horizontal">
949949
<TextBlock Text="&#xE74E;" FontFamily="Segoe Fluent Icons" Margin="0,0,8,0"/>
950950
<TextBlock Text="Save"/>
951951
</StackPanel>
952952
</Button>
953-
<Button x:Name="NewBtn" MinWidth="110" Margin="0,0,8,0" Padding="14,8">
953+
<Button x:Name="NewBtn" AutomationProperties.Name="New snip" MinWidth="110" Margin="0,0,8,0" Padding="14,8">
954954
<StackPanel Orientation="Horizontal">
955955
<TextBlock Text="&#xE7C5;" FontFamily="Segoe Fluent Icons" Margin="0,0,8,0"/>
956956
<TextBlock Text="New snip"/>
957957
</StackPanel>
958958
</Button>
959-
<Button x:Name="CloseBtn" MinWidth="110" Padding="14,8">
959+
<Button x:Name="CloseBtn" AutomationProperties.Name="Close preview" MinWidth="110" Padding="14,8">
960960
<StackPanel Orientation="Horizontal">
961961
<TextBlock Text="&#xE711;" FontFamily="Segoe Fluent Icons" Margin="0,0,8,0"/>
962962
<TextBlock Text="Close"/>
@@ -988,7 +988,9 @@ function Show-PreviewWindow {
988988
$win.Width = [math]::Max(640, $Bitmap.Width * $fitScale + $chromeW)
989989
$win.Height = [math]::Max(420, $Bitmap.Height * $fitScale + $chromeH)
990990

991-
$win.Add_SourceInitialized({ Set-MicaBackdrop -Window $win })
991+
# Mica backdrop intentionally not applied: DwmSetWindowAttribute(DWMSBT_MAINWINDOW)
992+
# is a no-op on windows declared AllowsTransparency="True" (this one is — see the
993+
# XAML above). See Set-MicaBackdrop for the P/Invoke if that constraint is ever lifted.
992994

993995
# Surface ANY WPF dispatcher exception. Copy to clipboard AND write to
994996
# %LOCALAPPDATA%\SnipIT\last-error.txt — a plain MessageBox doesn't always
@@ -1951,13 +1953,13 @@ function Show-FloatingWidget {
19511953
Width="240" Height="56" SizeToContent="Manual">
19521954
<Border CornerRadius="0" Background="#E61F1F1F" BorderBrush="#330078D4" BorderThickness="1">
19531955
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
1954-
<Button x:Name="SmartBtn" Width="96" Height="36" Margin="8,0,4,0">
1956+
<Button x:Name="SmartBtn" AutomationProperties.Name="Smart snip" Width="96" Height="36" Margin="8,0,4,0">
19551957
<StackPanel Orientation="Horizontal">
19561958
<TextBlock Text="&#xE7C5;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
19571959
<TextBlock Text="Snip"/>
19581960
</StackPanel>
19591961
</Button>
1960-
<Button x:Name="FullBtn" Width="112" Height="36" Margin="4,0,8,0">
1962+
<Button x:Name="FullBtn" AutomationProperties.Name="Full screen snip" Width="112" Height="36" Margin="4,0,8,0">
19611963
<StackPanel Orientation="Horizontal">
19621964
<TextBlock Text="&#xE740;" FontFamily="Segoe Fluent Icons" Margin="0,0,6,0"/>
19631965
<TextBlock Text="Full screen"/>

0 commit comments

Comments
 (0)