From 850864c6f11e1658dab1ea7141ed3a715f4d390a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Sat, 16 Mar 2024 15:29:37 +0100 Subject: [PATCH] minor accessibility improvements --- .../SoftwarePages/DiscoverPackages.xaml | 15 +++-- .../SoftwarePages/DiscoverPackages.xaml.cs | 2 + .../SoftwarePages/InstalledPackages.xaml | 13 ++-- .../SoftwarePages/InstalledPackages.xaml.cs | 2 + .../SoftwarePages/PackageBundle.xaml | 11 ++-- .../SoftwarePages/PackageBundle.xaml.cs | 1 + .../SoftwarePages/SoftwareUpdates.xaml | 13 ++-- .../SoftwarePages/SoftwareUpdates.xaml.cs | 2 + src/wingetui/Interface/Widgets/Announcer.xaml | 2 +- .../Interface/Widgets/Announcer.xaml.cs | 3 +- src/wingetui/Interface/Widgets/NavButton.xaml | 59 ++++++------------- .../Interface/Widgets/NavButton.xaml.cs | 19 ++---- 12 files changed, 65 insertions(+), 77 deletions(-) diff --git a/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml b/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml index 77cba11a5..7bb0d6942 100644 --- a/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml +++ b/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml @@ -621,10 +621,10 @@ @@ -672,7 +672,8 @@ + Padding="4,4,4,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Filter by source"> @@ -709,7 +710,8 @@ + Padding="16,8,16,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Filter options"> @@ -739,7 +741,8 @@ + Padding="16,8,16,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Search mode"> diff --git a/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml.cs b/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml.cs index 422c5287c..8effede74 100644 --- a/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml.cs +++ b/src/wingetui/Interface/SoftwarePages/DiscoverPackages.xaml.cs @@ -165,6 +165,8 @@ public DiscoverPackagesPage() LoadInterface(); _ = __load_packages(); + QueryBlock.PlaceholderText = Tools.Translate("Search for packages"); + } protected async Task __load_packages() diff --git a/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml b/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml index de28f55d9..7603ff8dc 100644 --- a/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml +++ b/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml @@ -624,7 +624,7 @@ VerticalContentAlignment="Center" /> @@ -672,7 +672,8 @@ + Padding="4,4,4,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Filter by source"> @@ -709,7 +710,8 @@ + Padding="16,8,16,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Filter options"> @@ -739,7 +741,8 @@ + Padding="16,8,16,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Search mode"> diff --git a/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml.cs b/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml.cs index de40ab874..fb929477b 100644 --- a/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml.cs +++ b/src/wingetui/Interface/SoftwarePages/InstalledPackages.xaml.cs @@ -170,6 +170,8 @@ public InstalledPackagesPage() GenerateToolBar(); LoadInterface(); _ = LoadPackages(); + + QueryBlock.PlaceholderText = Tools.Translate("Search for packages"); } public void ReloadPackages() diff --git a/src/wingetui/Interface/SoftwarePages/PackageBundle.xaml b/src/wingetui/Interface/SoftwarePages/PackageBundle.xaml index 5c42b300d..6359cbb01 100644 --- a/src/wingetui/Interface/SoftwarePages/PackageBundle.xaml +++ b/src/wingetui/Interface/SoftwarePages/PackageBundle.xaml @@ -625,7 +625,7 @@ VerticalContentAlignment="Center" /> @@ -687,7 +687,8 @@ + Padding="4,4,4,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Filter by sources"> @@ -725,7 +726,8 @@ + Padding="16,8,16,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Filter options"> @@ -755,7 +757,8 @@ + Padding="16,8,16,8" HorizontalContentAlignment="Stretch" + AutomationProperties.Name="Search mode"> diff --git a/src/wingetui/Interface/SoftwarePages/SoftwareUpdates.xaml.cs b/src/wingetui/Interface/SoftwarePages/SoftwareUpdates.xaml.cs index ac564a2c9..e708eb630 100644 --- a/src/wingetui/Interface/SoftwarePages/SoftwareUpdates.xaml.cs +++ b/src/wingetui/Interface/SoftwarePages/SoftwareUpdates.xaml.cs @@ -167,6 +167,8 @@ public SoftwareUpdatesPage() GenerateToolBar(); LoadInterface(); _ = LoadPackages(ManualCheck: false); + + QueryBlock.PlaceholderText = Tools.Translate("Search for packages"); } protected void AddPackageToSourcesList(UpgradablePackage package) diff --git a/src/wingetui/Interface/Widgets/Announcer.xaml b/src/wingetui/Interface/Widgets/Announcer.xaml index 9d937f466..a322c9148 100644 --- a/src/wingetui/Interface/Widgets/Announcer.xaml +++ b/src/wingetui/Interface/Widgets/Announcer.xaml @@ -8,7 +8,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - + diff --git a/src/wingetui/Interface/Widgets/Announcer.xaml.cs b/src/wingetui/Interface/Widgets/Announcer.xaml.cs index 1b510d00b..4d1d85fc5 100644 --- a/src/wingetui/Interface/Widgets/Announcer.xaml.cs +++ b/src/wingetui/Interface/Widgets/Announcer.xaml.cs @@ -42,7 +42,8 @@ public Announcer() DefaultStyleKey = typeof(Announcer); BringIntoViewRequested += (s, e) => { LoadAnnouncements(); }; - PointerPressed += (s, e) => { LoadAnnouncements(); }; + int i = 0; + PointerPressed += (s, e) => { if(i++ %3 != 0) LoadAnnouncements(); }; SetText(binder.Translate("Fetching latest announcements, please wait...")); _textblock.TextWrapping = TextWrapping.Wrap; diff --git a/src/wingetui/Interface/Widgets/NavButton.xaml b/src/wingetui/Interface/Widgets/NavButton.xaml index f12760aa6..4385c7e4f 100644 --- a/src/wingetui/Interface/Widgets/NavButton.xaml +++ b/src/wingetui/Interface/Widgets/NavButton.xaml @@ -22,14 +22,31 @@ + + + + + + + + - - - - - - - - diff --git a/src/wingetui/Interface/Widgets/NavButton.xaml.cs b/src/wingetui/Interface/Widgets/NavButton.xaml.cs index 434656899..003428e33 100644 --- a/src/wingetui/Interface/Widgets/NavButton.xaml.cs +++ b/src/wingetui/Interface/Widgets/NavButton.xaml.cs @@ -1,9 +1,12 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Media; using ModernWindow.Structures; using System; using System.Linq; +using System.Runtime.CompilerServices; +using Windows.Media.Devices; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -50,22 +53,8 @@ public NavButton() { string val = Tools.Translate((string)e.NewValue); int count = val.Count(x => x == ' '); - /*if (count > 0) - { - Height = 58 + 14*count; - VariableGrid.RowDefinitions[1].Height = new GridLength(26 + 14 * count); - TextBlock.Height = 18 + 14 * count; - TextBlock.HorizontalAlignment = HorizontalAlignment.Center; - TextBlock.VerticalAlignment = VerticalAlignment.Center; - TextBlock.TextAlignment = TextAlignment.Center; - } - else - { - Height = 58; - TextBlock.Height = 18; - VariableGrid.RowDefinitions[1].Height = new GridLength(26); - }*/ TextBlock.Text = val.Replace(" ", "\x0a"); + ToggleButton.Content = val.Replace(" ", "\x0a"); })) );