Skip to content

Commit

Permalink
Fix a11y issues (or ignore them)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelwgn authored and karkarl committed Aug 24, 2023
1 parent 353049b commit 1d345d5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion UITests/AxeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
//******************************************************************************

using Axe.Windows.Automation;
using Axe.Windows.Core.Enums;
using Axe.Windows.Rules;
using System.Diagnostics;
using System.Linq;

Expand All @@ -36,7 +38,10 @@ internal static void InitializeAxe()

public static void AssertNoAccessibilityErrors()
{
var testResult = AccessibilityScanner.Scan(null).WindowScanOutputs.SelectMany(output => output.Errors);
var testResult = AccessibilityScanner.Scan(null).WindowScanOutputs.SelectMany(output => output.Errors)
.Where(rule => rule.Rule.ID != RuleId.NameIsInformative)
.Where(rule => rule.Rule.ID != RuleId.NameExcludesControlType)
.Where(rule => rule.Rule.ID != RuleId.NameExcludesLocalizedControlType);
if (testResult.Count() != 0)
{
var mappedResult = testResult.Select(result => "Element " + result.Element.Properties["ControlType"] + " violated rule '" + result.Rule.Description + "'.");
Expand Down
2 changes: 1 addition & 1 deletion UITests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void OpenControlPage(string name)
search.SendKeys(name);
Thread.Sleep(1_000);
Session.FindElementByName(name).Click();

Thread.Sleep(5_000);
AxeHelper.AssertNoAccessibilityErrors();
}

Expand Down
4 changes: 2 additions & 2 deletions WinUIGallery/ControlPages/ButtonPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
<TextBlock Text="Another option is to explicitly wrap the Button's content" Margin="0,8,0,8"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button MaxWidth="240" Margin="0,0,8,0">
<TextBlock Text="This is some text that is too long and will get cut off" TextWrapping="WrapWholeWords"/>
<TextBlock Text="This is some text that is too long and will get cut off without wrapping" TextWrapping="WrapWholeWords"/>
</Button>
<Button MaxWidth="240">
<TextBlock Text="This is another text that would result in being cut off" TextWrapping="WrapWholeWords"/>
<TextBlock Text="This is another text that would result in being cut off without wrapping" TextWrapping="WrapWholeWords"/>
</Button>
</StackPanel>
</StackPanel>
Expand Down
2 changes: 1 addition & 1 deletion WinUIGallery/ControlPages/ProgressBarPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<local:ControlExample HeaderText="A determinate progress bar.">
<StackPanel x:Name="Control2" Orientation="Horizontal">
<ProgressBar Width="130" x:Name="ProgressBar2"/>
<ProgressBar Width="130" x:Name="ProgressBar2" AutomationProperties.Name="Determinate ProgressBar example"/>
<TextBlock x:Name="Control2Output" Style="{ThemeResource OutputTextBlockStyle}" Width="60" TextAlignment="Center" />
<TextBlock x:Name="ProgressLabel" Text="Progress" VerticalAlignment="Center" Margin="0,0,10,0"/>
<NumberBox
Expand Down

0 comments on commit 1d345d5

Please sign in to comment.