Skip to content

Commit 470ed9b

Browse files
committed
fix: run real blocking accessibility scans
1 parent a74cd60 commit 470ed9b

31 files changed

Lines changed: 500 additions & 140 deletions

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,9 @@ jobs:
278278
--logger trx;LogFileName=OpenClaw.Tray.UITests.trx
279279
--filter Category!=Accessibility"
280280
281-
# Accessibility Insights CI pass: runs Axe.Windows scans against each app page.
282-
# Uses continue-on-error so violations surface as a visible warning without
283-
# blocking the build while the team remediates. Remove continue-on-error once
284-
# all violations are resolved (see PR #921 for the initial fixes).
281+
# Accessibility Insights CI pass: scans each page in the real app process.
285282
- name: Run Accessibility Tests (Axe.Windows)
286283
id: a11y
287-
continue-on-error: true
288284
run: >
289285
dotnet test tests/OpenClaw.Tray.UITests
290286
--no-build
@@ -300,12 +296,10 @@ jobs:
300296
shell: pwsh
301297
run: |
302298
if ("${{ steps.a11y.outcome }}" -eq "failure") {
303-
"### :warning: Accessibility violations detected" >> $env:GITHUB_STEP_SUMMARY
299+
"### :x: Accessibility violations detected" >> $env:GITHUB_STEP_SUMMARY
304300
"" >> $env:GITHUB_STEP_SUMMARY
305301
"Axe.Windows scans found WCAG violations in one or more pages." >> $env:GITHUB_STEP_SUMMARY
306302
"See the `Accessibility.trx` artifact for details." >> $env:GITHUB_STEP_SUMMARY
307-
"" >> $env:GITHUB_STEP_SUMMARY
308-
"Fixes for known violations: [PR #921](https://github.com/${{ github.repository }}/pull/921)" >> $env:GITHUB_STEP_SUMMARY
309303
} else {
310304
"### :white_check_mark: Accessibility scans passed" >> $env:GITHUB_STEP_SUMMARY
311305
"" >> $env:GITHUB_STEP_SUMMARY

‎src/OpenClaw.Tray.WinUI/App.xaml.cs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,9 @@ _dispatcherQueue is null
539539
useSshTunnel = _settings.UseSshTunnel
540540
});
541541

542-
// Register URI scheme on first run
543-
DeepLinkHandler.RegisterUriScheme();
542+
// Isolated test instances must not replace the user's installed protocol handler.
543+
if (DataDirOverride is null)
544+
DeepLinkHandler.RegisterUriScheme();
544545

545546
// Anchor the WinUI runtime so transient windows (UpdateDialog,
546547
// setup wizard, etc.) don't terminate the process when closed.

‎src/OpenClaw.Tray.WinUI/Chat/OpenClawComposer.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ public override Element Render()
251251
HorizontalAlignment = HorizontalAlignment.Stretch,
252252
VerticalAlignment = VerticalAlignment.Center,
253253
};
254+
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(
255+
cb,
256+
LocalizationHelper.GetString("Chat_Composer_Accessibility_Session"));
254257

255258
ComboBoxItem? selectedItem = null;
256259
foreach (var group in groups)
@@ -359,6 +362,9 @@ public override Element Render()
359362
HorizontalAlignment = HorizontalAlignment.Stretch,
360363
VerticalAlignment = VerticalAlignment.Center,
361364
};
365+
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(
366+
cb,
367+
LocalizationHelper.GetString("Chat_Composer_Accessibility_Model"));
362368

363369
ComboBoxItem? selectedItem = null;
364370
for (int i = 0; i < modelEntries.Count; i++)
@@ -404,6 +410,9 @@ public override Element Render()
404410
})
405411
.Set(cb =>
406412
{
413+
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(
414+
cb,
415+
LocalizationHelper.GetString("Chat_Composer_Accessibility_Reasoning"));
407416
cb.MinWidth = 0;
408417
cb.Width = double.NaN;
409418
cb.Height = 28;
@@ -552,6 +561,9 @@ public override Element Render()
552561
.Set(tb =>
553562
{
554563
textBoxRef.Current = tb;
564+
Microsoft.UI.Xaml.Automation.AutomationProperties.SetAutomationId(
565+
tb,
566+
"ChatComposerInput");
555567
tb.PlaceholderText = recording
556568
? LocalizationHelper.GetString("Chat_Voice_ListeningPrompt")
557569
: placeholder;

‎src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
<StackPanel Grid.Row="0" Spacing="4" Margin="0,0,0,12">
1818
<StackPanel Orientation="Horizontal" Spacing="8">
19-
<TextBlock x:Uid="AgentEventsPage_TextBlock_18" Text="Event Stream" Style="{StaticResource TitleTextBlockStyle}"/>
19+
<TextBlock x:Uid="AgentEventsPage_TextBlock_18" Text="Event Stream"
20+
AutomationProperties.AutomationId="AgentEventsPageMarker"
21+
Style="{StaticResource TitleTextBlockStyle}"/>
2022
<Border x:Name="LiveBadge" CornerRadius="4" Padding="6,2,8,3" VerticalAlignment="Center"
2123
Background="#20FF4444">
2224
<StackPanel Orientation="Horizontal" Spacing="4">
@@ -48,11 +50,12 @@
4850
SelectionChanged="OnAgentFilterComboChanged">
4951
<ComboBoxItem x:Uid="AgentEventsPage_ComboBoxItem_26" Content="All Agents" Tag="" IsSelected="True"/>
5052
</ComboBox>
51-
<Button x:Name="ClearButton" Grid.Column="2" Click="OnClear">
53+
<Button x:Name="ClearButton" Grid.Column="2" Click="OnClear"
54+
AutomationProperties.LabeledBy="{Binding ElementName=ClearButtonLabel}">
5255
<StackPanel Orientation="Horizontal" Spacing="8">
5356
<FontIcon Glyph="{x:Bind helpers:FluentIconCatalog.Clear, Mode=OneTime}"
5457
FontSize="14" IsTextScaleFactorEnabled="False"/>
55-
<TextBlock x:Uid="AgentEventsPage_ClearButton" Text="Clear"/>
58+
<TextBlock x:Uid="AgentEventsPage_ClearButton" x:Name="ClearButtonLabel" Text="Clear"/>
5659
</StackPanel>
5760
</Button>
5861
</Grid>

‎src/OpenClaw.Tray.WinUI/Pages/BindingsPage.xaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
</Grid.ColumnDefinitions>
1616
<StackPanel Spacing="2">
1717
<TextBlock x:Uid="BindingsPage_TextBlock_16" Text="Bindings"
18+
AutomationProperties.AutomationId="BindingsPageMarker"
1819
Style="{StaticResource TitleTextBlockStyle}"/>
1920
<TextBlock x:Uid="BindingsPage_TextBlock_17" Text="Message routing rules"
2021
Foreground="{ThemeResource TextFillColorSecondaryBrush}"

‎src/OpenClaw.Tray.WinUI/Pages/ChannelsPage.xaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
</Grid.ColumnDefinitions>
3838
<StackPanel Spacing="4">
3939
<TextBlock x:Uid="ChannelsPage_Title" Text="Channels"
40+
AutomationProperties.AutomationId="ChannelsPageMarker"
4041
Style="{StaticResource TitleTextBlockStyle}"/>
4142
<TextBlock x:Name="MetaText"
4243
Style="{StaticResource CaptionTextBlockStyle}"

‎src/OpenClaw.Tray.WinUI/Pages/ChatPage.xaml.cs‎

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public sealed partial class ChatPage : Page
2727
private HubWindow? _hub;
2828
private MountedFunctionalChat? _functionalHost;
2929
private IChatDataProvider? _mountedProvider;
30+
private IChatDataProvider? _accessibilityTestProvider;
3031
private string? _mountedThreadId;
3132
private string? _chatUrl;
3233
private bool _webViewInitialized;
@@ -230,7 +231,7 @@ private void ShowFunctionalSurface()
230231
DevToolsButton.Visibility = Visibility.Collapsed;
231232

232233
var app = App.Current as App;
233-
var provider = app?.ChatProvider;
234+
var provider = ResolveChatProvider(app);
234235
Func<string, Task>? readAloud = app is null ? null : app.SpeakChatTextAsync;
235236

236237
// Consume a pending session-key hand-off from SessionsPage or a
@@ -311,6 +312,116 @@ private void ShowFunctionalSurface()
311312
}
312313
}
313314

315+
private IChatDataProvider? ResolveChatProvider(App? app)
316+
{
317+
if (app?.ChatProvider is { } liveProvider)
318+
return liveProvider;
319+
320+
// The accessibility suite launches an isolated app process without a
321+
// gateway. Mount a deterministic provider only under its explicit
322+
// test flag so Axe scans the real FunctionalUI timeline and composer,
323+
// not merely the disconnected page shell.
324+
if (Environment.GetEnvironmentVariable("OPENCLAW_ACCESSIBILITY_TEST_CHAT") == "1"
325+
&& Environment.GetEnvironmentVariable("OPENCLAW_TRAY_DATA_DIR") is { Length: > 0 })
326+
{
327+
return _accessibilityTestProvider ??= new AccessibilityChatDataProvider();
328+
}
329+
330+
return null;
331+
}
332+
333+
private sealed class AccessibilityChatDataProvider : IChatDataProvider
334+
{
335+
private const string ThreadId = "accessibility-main";
336+
private static readonly ChatDataSnapshot Snapshot = CreateSnapshot();
337+
338+
public string DisplayName => "Accessibility test chat";
339+
340+
public event EventHandler<ChatDataChangedEventArgs>? Changed
341+
{
342+
add { }
343+
remove { }
344+
}
345+
346+
public event EventHandler<ChatProviderNotificationEventArgs>? NotificationRequested
347+
{
348+
add { }
349+
remove { }
350+
}
351+
352+
public Task<ChatDataSnapshot> LoadAsync(CancellationToken cancellationToken = default)
353+
=> Task.FromResult(Snapshot);
354+
355+
public Task SendMessageAsync(
356+
string threadId,
357+
string message,
358+
CancellationToken cancellationToken = default)
359+
=> Task.CompletedTask;
360+
361+
public Task StopResponseAsync(string threadId, CancellationToken cancellationToken = default)
362+
=> Task.CompletedTask;
363+
364+
public Task SetThreadSuspendedAsync(string threadId, bool suspended, CancellationToken cancellationToken = default)
365+
=> Task.CompletedTask;
366+
367+
public Task DeleteThreadAsync(string threadId, CancellationToken cancellationToken = default)
368+
=> Task.CompletedTask;
369+
370+
public Task SetModelAsync(string threadId, string model, CancellationToken cancellationToken = default)
371+
=> Task.CompletedTask;
372+
373+
public Task SetThinkingLevelAsync(string threadId, string thinkingLevel, CancellationToken cancellationToken = default)
374+
=> Task.CompletedTask;
375+
376+
public Task SetPermissionModeAsync(string threadId, bool allowAll, CancellationToken cancellationToken = default)
377+
=> Task.CompletedTask;
378+
379+
public Task RespondToPermissionAsync(
380+
string threadId,
381+
string requestId,
382+
string action,
383+
CancellationToken cancellationToken = default)
384+
=> Task.CompletedTask;
385+
386+
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
387+
388+
private static ChatDataSnapshot CreateSnapshot()
389+
{
390+
var timeline = ChatTimelineState.Initial() with
391+
{
392+
Entries = ChatTimelineState.Initial().Entries
393+
.Add(new ChatTimelineItem(
394+
"accessibility-user",
395+
ChatTimelineItemKind.User,
396+
"Verify the native chat surface."))
397+
.Add(new ChatTimelineItem(
398+
"accessibility-assistant",
399+
ChatTimelineItemKind.Assistant,
400+
"The timeline and composer are ready.")),
401+
NextId = 3,
402+
HistoryLoaded = true,
403+
};
404+
405+
return new ChatDataSnapshot(
406+
[new ChatThread
407+
{
408+
Id = ThreadId,
409+
Title = "Accessibility session",
410+
Status = ChatThreadStatus.Running,
411+
Activity = ChatActivity.Idle,
412+
Model = "test-model",
413+
}],
414+
new Dictionary<string, ChatTimelineState>
415+
{
416+
[ThreadId] = timeline,
417+
},
418+
ThreadId,
419+
"Connected (accessibility test)",
420+
["test-model"],
421+
new ChatComposeTarget(ThreadId, IsReady: true));
422+
}
423+
}
424+
314425
private void ShowWebViewSurface(bool forceNavigate = false)
315426
{
316427
// Consume pending session key for WebView mode.

‎src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
</Grid.ColumnDefinitions>
2828
<StackPanel Grid.Column="0" Spacing="4">
2929
<TextBlock x:Uid="ConfigPage_TextBlock_17" Text="Config"
30+
AutomationProperties.AutomationId="ConfigPageMarker"
3031
Style="{StaticResource TitleTextBlockStyle}"/>
3132
<TextBlock x:Uid="ConfigSubtitle" x:Name="ConfigSubtitle"
3233
Text="Edit gateway configuration (openclaw.json) with a schema-guided form."
@@ -40,10 +41,11 @@
4041
</StackPanel>
4142
<Button Grid.Column="1"
4243
x:Name="RefreshButton" Click="OnRefresh"
44+
AutomationProperties.LabeledBy="{Binding ElementName=RefreshButtonLabel}"
4345
VerticalAlignment="Center">
4446
<StackPanel Orientation="Horizontal" Spacing="6">
4547
<FontIcon Glyph="&#xE72C;" FontSize="14"/>
46-
<TextBlock x:Uid="ConfigPage_TextBlock_21" Text="Refresh"/>
48+
<TextBlock x:Uid="ConfigPage_TextBlock_21" x:Name="RefreshButtonLabel" Text="Refresh"/>
4749
</StackPanel>
4850
</Button>
4951
</Grid>
@@ -226,8 +228,11 @@
226228

227229
<toolkit:GridSplitter Grid.Column="3"
228230
x:Name="JsonPreviewSplitter"
231+
x:Uid="JsonPreviewSplitter"
229232
ResizeDirection="Columns"
230233
ResizeBehavior="PreviousAndNext"
234+
AutomationProperties.Name="Resize JSON preview"
235+
AutomationProperties.LocalizedControlType="splitter"
231236
HorizontalAlignment="Stretch"
232237
VerticalAlignment="Stretch"
233238
Background="{ThemeResource CardStrokeColorDefaultBrush}"/>

‎src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
<!-- Headline + sub + glance chips -->
134134
<StackPanel Grid.Column="1" VerticalAlignment="Center" Spacing="2">
135135
<TextBlock x:Uid="ConnectionPage_NotConnected" x:Name="StripHeadline" Text="Not connected"
136+
AutomationProperties.AutomationId="ConnectionPageMarker"
136137
Style="{StaticResource SubtitleTextBlockStyle}"
137138
AutomationProperties.HeadingLevel="Level1"
138139
AutomationProperties.LiveSetting="Polite"

‎src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
<ColumnDefinition Width="Auto"/>
2727
<ColumnDefinition Width="Auto"/>
2828
</Grid.ColumnDefinitions>
29-
<TextBlock x:Uid="CronPage_CronJobs" Text="Cron Jobs" Style="{StaticResource TitleTextBlockStyle}" Grid.Column="0" VerticalAlignment="Center"/>
29+
<TextBlock x:Uid="CronPage_CronJobs" Text="Cron Jobs"
30+
AutomationProperties.AutomationId="CronPageMarker"
31+
Style="{StaticResource TitleTextBlockStyle}" Grid.Column="0" VerticalAlignment="Center"/>
3032
<TextBlock x:Name="JobCountText" Text="(0)" VerticalAlignment="Center" Grid.Column="1" Margin="8,0,0,0"
3133
Style="{StaticResource CaptionTextBlockStyle}"
3234
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>

0 commit comments

Comments
 (0)