fix(app): accessibility of hashes, paths, results and shortcuts
The fixable known limitations of ACCESSIBILITY.md:
- Hashes, file names and paths keep left-to-right order in right-to-left languages (FlowDirection on each control,
not on the rows, so buttons keep their mirrored order).
- Verify shows the computed hash of a mismatched file under the expected one, in a read-only box that is focusable and
named "Computed hash"; it used to be only in the status tooltip, which bypassed hash masking (now masked too). The
expected-hash box is named "Expected hash" instead of its placeholder.
- A run of one file ends with its result in a live text at the top of the page ("photo.jpg: VALID"), which screen
readers announce; several files still end with the summary dialog.
- Shortcut tooltips use the platform's notation (⌘O on macOS) and the buttons and search box expose them as
AcceleratorKey.
ACCESSIBILITY.md is reviewed for 1.3.0: the maintainer's keyboard-only and Narrator test, the email address for people
who cannot use GitHub, the remaining limitations, and two new rules for contributors. New strings: Lbl_ExpectedHash,
Lbl_ComputedHash, Msg_RowResult.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f257ec9393
commit
6c4cd062cc
11 files changed
+234
-39
No files matched your search
+23
-15
@@ -1,6 +1,6 @@
|
||||
# Accessibility
|
||||
|
||||
**Last reviewed: November 2026 (Hash Tool 1.2.3)**
|
||||
**Last reviewed: November 2026 (Hash Tool 1.3.0)**
|
||||
|
||||
Hash Tool should work for everyone who needs to check a file: with a keyboard alone, with a screen reader, with large
|
||||
text or high contrast, and in their own language. This page describes what works today, what does not work yet, and how
|
||||
@@ -40,11 +40,16 @@ options and to each algorithm's hash and copy button.
|
||||
| Delete | Remove the selected row |
|
||||
| Enter, in a dialog | The highlighted button (OK, Yes) |
|
||||
|
||||
Tooltips show a button's shortcut in your platform's notation (⌘O on macOS), and screen readers announce it with the
|
||||
button.
|
||||
|
||||
**Screen readers.** Every button, box, list and row has a translated name: icon buttons are named after their action
|
||||
("Copy Hash", "Remove File") and rows after their file name. Page titles and section titles are headings, and the
|
||||
navigation pane and the page are landmarks, so you can jump between them. The update and notice banners and the status
|
||||
on the Update page are announced when they change. After a run with several files, a summary dialog opens and takes the
|
||||
focus.
|
||||
on the Update page are announced when they change. After a run of one file, its result (for example "photo.jpg: VALID")
|
||||
is announced and shown at the top of the page; after a run with several files, a summary dialog opens and takes the
|
||||
focus. When a file does not match, Verify shows the hash it really has under the expected one, in a box you can focus
|
||||
and copy.
|
||||
|
||||
**Results in words, not only colour.** Every status is text: **VALID**, **MISMATCH!**, *Access denied*, *Timed out* and
|
||||
so on. Search matches are shown in bold as well as in colour.
|
||||
@@ -57,8 +62,8 @@ least 3:1; automated tests check this. Settings has the font, a font size from 1
|
||||
**No mouse or drag and drop needed.** Everything you can drop has a button too: **Add Files…**, **Add Folder…**,
|
||||
**Open Checksum File…**, and **Browse** for the expected hash of a row. You can also paste the expected hash.
|
||||
|
||||
**Language.** The app comes in 67 languages, with right-to-left layouts for Arabic, Persian, Hebrew, Dhivehi and Pashto.
|
||||
It picks your system language automatically.
|
||||
**Language.** The app comes in 67 languages, with right-to-left layouts for Arabic, Persian, Hebrew, Dhivehi and Pashto,
|
||||
in which hashes, file names and paths keep their left-to-right order. It picks your system language automatically.
|
||||
|
||||
**Motion and sound.** The only animation is a 0.3-second colour fade when the theme changes. The app makes no sounds,
|
||||
and nothing flashes.
|
||||
@@ -76,7 +81,7 @@ and nothing flashes.
|
||||
|
||||
| Platform | Assistive technology | Status |
|
||||
|---|---|---|
|
||||
| Windows 10 and 11 | Keyboard only, Narrator | Tested by the maintainer with Hash Tool 1.2 (November 2026). The 1.2.3 fixes were checked with automated tests and with the UI Automation tree that screen readers read. |
|
||||
| Windows 10 and 11 | Keyboard only (mouse turned off), Narrator | Tested by the maintainer on Windows 11 with Hash Tool 1.2.3 (November 2026); no problems found. The 1.3.0 changes were checked with automated tests and with the UI Automation tree that screen readers read. |
|
||||
| Windows 10 and 11 | NVDA, JAWS | Expected to work, since they read the same UI Automation tree as Narrator. Not tested regularly; reports are welcome. |
|
||||
| macOS (Apple silicon and Intel) | VoiceOver | Not tested yet. Avalonia exposes the app to macOS accessibility. |
|
||||
| Linux (x64 AppImage) | Orca | Not tested yet. Avalonia's AT-SPI support is newer and may be incomplete. |
|
||||
@@ -86,8 +91,8 @@ and nothing flashes.
|
||||
|
||||
These are known problems, with a workaround where one exists. Please report anything else.
|
||||
|
||||
- **Progress is not read aloud during a run.** Each row shows its status as text, and a run with several files ends
|
||||
with a summary dialog. After a single file, move to its row to hear the result.
|
||||
- **Progress is not read aloud during a run.** Each row shows its status as text, the result of a run of one file is
|
||||
announced, and a run with several files ends with a summary dialog.
|
||||
- **The app does not follow the system's contrast themes** (Windows contrast themes, macOS *Increase contrast*). Choose
|
||||
*Settings → Theme style → High Contrast*. Standard controls such as buttons and the focus rectangle keep the colours
|
||||
of the Fluent theme.
|
||||
@@ -96,12 +101,9 @@ These are known problems, with a workaround where one exists. Please report anyt
|
||||
- **The Developer console uses fixed colours** (light text on a dark background) in every theme.
|
||||
- **The Glassmorphism style and the translucent window background** (Windows and macOS) depend on what is behind the
|
||||
window. Pick another style if text is hard to read.
|
||||
- **Tooltips appear on mouse hover only.** On Verify, the computed hash is only in the tooltip of the status; Generate
|
||||
shows it in a text box you can focus and copy.
|
||||
- **Tooltips appear on mouse hover only.** What they show is also on screen or announced: a button's shortcut, a file's
|
||||
folder, and on Verify the computed hash of a file that does not match.
|
||||
- **Dialogs cannot be moved with the keyboard.** They open centred over the main window.
|
||||
- **Hashes and paths are not forced left-to-right** in right-to-left layouts, so they may be displayed in the wrong
|
||||
direction.
|
||||
- **Shortcuts in tooltips say Ctrl on macOS too.** Use ⌘.
|
||||
- **Most translations were made with AI assistance**, including the names screen readers announce. Corrections from
|
||||
native speakers are welcome.
|
||||
- **The command-line tool is in English only.**
|
||||
@@ -111,7 +113,8 @@ These are known problems, with a workaround where one exists. Please report anyt
|
||||
|
||||
Open an issue with the
|
||||
[Accessibility issue form](https://github.com/poli0981/HashTool/issues/new?template=accessibility.yml). If the form is
|
||||
hard to use, a plain issue or a post in [Discussions](https://github.com/poli0981/HashTool/discussions) is fine too.
|
||||
hard to use, a plain issue or a post in [Discussions](https://github.com/poli0981/HashTool/discussions) is fine too. If
|
||||
you cannot use GitHub, email [accessibility@poli0981.dev](mailto:accessibility@poli0981.dev).
|
||||
|
||||
Helpful details:
|
||||
|
||||
@@ -149,13 +152,18 @@ When you change the UI:
|
||||
while focused hands the focus on with `controls:FocusHandOff.Target`; lists with controls in their rows use
|
||||
`controls:RowTabNavigation.IsEnabled`.
|
||||
- Never use colour as the only signal. New colours in `ThemePalettes` keep 4.5:1 for text and 3:1 for icons.
|
||||
- Hashes, file names and paths get `FlowDirection="LeftToRight"`, so right-to-left languages do not reorder them.
|
||||
- Shortcut texts come from `controls:Shortcuts` (tooltip and `AutomationProperties.AcceleratorKey`), never a literal
|
||||
"Ctrl+…".
|
||||
- Page titles use `AutomationProperties.HeadingLevel="1"`; section titles use the `sectionTitle` class.
|
||||
- Add new text to every language with `python -I eng/loc.py set` (see [CONTRIBUTING.md](CONTRIBUTING.md)).
|
||||
|
||||
Testing:
|
||||
|
||||
- **Automated:** `tests/HashTool.App.Tests/AccessibilityTests.cs` checks names on every page in two languages, headings,
|
||||
Tab inside file rows, focus when buttons swap, and the contrast of every theme. CI runs it on Windows, macOS and Linux.
|
||||
Tab inside file rows, focus when buttons swap, left-to-right hashes and paths in Arabic, the computed hash and the
|
||||
announced result of a mismatch, shortcut notation, and the contrast of every theme. CI runs it on Windows, macOS and
|
||||
Linux.
|
||||
- **By hand, for UI changes:** one pass with the keyboard only, a quick check with a screen reader (Narrator:
|
||||
Win+Ctrl+Enter; VoiceOver: ⌘+F5; Orca on Linux), UI scale 2.0, and the High Contrast style.
|
||||
[Accessibility Insights for Windows](https://accessibilityinsights.io/docs/windows/overview/) shows what screen
|
||||
|
||||
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
|
||||
- **Hash Text** page: type or paste text and see its hash in every algorithm, updated as you type, with a copy button for each. Choose UTF-8 or UTF-16 and LF or CRLF line breaks; nothing is added at the end, so the SHA-256 matches `printf '%s' 'text' | sha256sum`. Suggested in [Discussions #23](https://github.com/poli0981/HashTool/discussions/23). This is Hash Tool's last new feature: from 1.3.0 on, the project is in maintenance mode.
|
||||
- `hashtool hash -` hashes standard input, as `sha256sum -` does.
|
||||
|
||||
### Fixed
|
||||
- Accessibility: in right-to-left languages, hashes, file names and paths keep their left-to-right order.
|
||||
- Accessibility: when a file does not match, Verify shows the hash it really has under the expected one, in a box the keyboard and screen readers reach; before, it was only in a tooltip, which also ignored hash masking. The expected-hash box is announced as "Expected hash" instead of its placeholder text.
|
||||
- Accessibility: the result of a run of one file (for example "photo.jpg: VALID") is announced by screen readers and shown at the top of the page; a run of several files still ends with the summary dialog.
|
||||
- Accessibility: tooltips show shortcuts the macOS way (⌘O) on macOS, and screen readers announce the shortcuts of Add Files, Add Folder, Compute/Verify All, Cancel and the search box.
|
||||
|
||||
### Security
|
||||
- Updated to the .NET 10.0.15 runtime, which the self-contained downloads include. It fixes denial of service and elevation of privilege vulnerabilities in .NET (CVE-2026-109475, CVE-2026-105544, CVE-2026-114155, CVE-2026-118747).
|
||||
|
||||
|
||||
@@ -50,8 +50,12 @@ public sealed class StatusTextConverter : IMultiValueConverter
|
||||
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values.Count < 3 || values[0] is not ItemStatus status || values[2] is not LocalizationProxy localization) return null;
|
||||
var detail = values[1] as string;
|
||||
return status switch
|
||||
return Text(status, values[1] as string, localization);
|
||||
}
|
||||
|
||||
/// <summary>The translated text of a row's status.</summary>
|
||||
public static string Text(ItemStatus status, string? detail, LocalizationProxy localization) =>
|
||||
status switch
|
||||
{
|
||||
ItemStatus.Ready => localization["Lbl_Status_Ready"],
|
||||
ItemStatus.Queued => localization["Status_Queued"],
|
||||
@@ -76,7 +80,6 @@ public sealed class StatusTextConverter : IMultiValueConverter
|
||||
ItemStatus.UnreadableHashFile => localization["Status_ReadError"],
|
||||
_ => status.ToString()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Severity class for the status column (success / error / warning / muted).</summary>
|
||||
@@ -91,6 +94,8 @@ public static class StatusSeverity
|
||||
|
||||
public static readonly IValueConverter IsWarning = new FuncValueConverter<ItemStatus, bool>(s =>
|
||||
s is ItemStatus.Cancelled or ItemStatus.TimedOut or ItemStatus.MissingHash or ItemStatus.NoHashInFile);
|
||||
|
||||
public static readonly IValueConverter IsMismatch = new FuncValueConverter<ItemStatus, bool>(s => s == ItemStatus.Mismatch);
|
||||
}
|
||||
|
||||
/// <summary>Colour classes for log entries in the Developer console.</summary>
|
||||
|
||||
@@ -782,4 +782,13 @@
|
||||
<data name="Tip_CopyAlgorithmHash" xml:space="preserve">
|
||||
<value>Copy {0} hash</value>
|
||||
</data>
|
||||
<data name="Lbl_ExpectedHash" xml:space="preserve">
|
||||
<value>Expected hash</value>
|
||||
</data>
|
||||
<data name="Lbl_ComputedHash" xml:space="preserve">
|
||||
<value>Computed hash</value>
|
||||
</data>
|
||||
<data name="Msg_RowResult" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -10,6 +10,7 @@ using Avalonia.Collections;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using HashTool.App.Converters;
|
||||
using HashTool.App.Infrastructure;
|
||||
using HashTool.App.Models;
|
||||
using HashTool.App.Services;
|
||||
@@ -64,6 +65,12 @@ public abstract partial class FileListViewModelBase : ObservableObject, IHashJob
|
||||
|
||||
[ObservableProperty] private LocalizationProxy _localization;
|
||||
|
||||
/// <summary>
|
||||
/// The result of a run of one file ("name: VALID"), shown in the page header and read by screen readers (a live
|
||||
/// region); a run of several files ends with the summary dialog instead.
|
||||
/// </summary>
|
||||
[ObservableProperty] private string? _announcement;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(CanModify))]
|
||||
[NotifyCanExecuteChangedFor(nameof(AddFilesCommand), nameof(AddFolderCommand), nameof(ClearListCommand),
|
||||
@@ -354,6 +361,7 @@ public abstract partial class FileListViewModelBase : ObservableObject, IHashJob
|
||||
_byPath.Clear();
|
||||
Items.Clear();
|
||||
ResetBatchStats();
|
||||
Announcement = null;
|
||||
OnPropertyChanged(nameof(HasItems));
|
||||
OnPropertyChanged(nameof(TotalFilesText));
|
||||
Logger.LogInformation("List cleared");
|
||||
@@ -463,6 +471,7 @@ public abstract partial class FileListViewModelBase : ObservableObject, IHashJob
|
||||
{
|
||||
if (items.Count == 0 || !CanModify) return;
|
||||
IsBusy = true;
|
||||
Announcement = null;
|
||||
ResetBatchStats();
|
||||
_batchCts = new CancellationTokenSource();
|
||||
try
|
||||
@@ -510,6 +519,8 @@ public abstract partial class FileListViewModelBase : ObservableObject, IHashJob
|
||||
|
||||
Logger.LogInformation("Finished in {Elapsed}: {Succeeded} succeeded, {Failed} failed, {Cancelled} cancelled",
|
||||
_batchClock.Elapsed, SucceededCount, FailedCount, CancelledCount);
|
||||
if (items is [var single])
|
||||
Announcement = L.Format("Msg_RowResult", single.FileName, StatusTextConverter.Text(single.Status, single.StatusDetail, Localization));
|
||||
await OnBatchFinishedAsync(items);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Spacing="2">
|
||||
<TextBlock Text="{Binding TotalFilesText}" Classes="secondary" HorizontalAlignment="Right" IsVisible="{Binding !IsBusy}" />
|
||||
<!-- The result of a one-file run, announced by screen readers (a run of several files ends with a dialog). -->
|
||||
<TextBlock Text="{Binding Announcement}" FontWeight="SemiBold" HorizontalAlignment="Right" MaxWidth="420"
|
||||
TextTrimming="CharacterEllipsis" AutomationProperties.LiveSetting="Polite" />
|
||||
<TextBlock Text="{Binding ProgressText}" FontWeight="Bold" HorizontalAlignment="Right" IsVisible="{Binding IsBusy}" />
|
||||
<TextBlock Text="{Binding DetailText}" FontSize="11" HorizontalAlignment="Right" IsVisible="{Binding IsBusy}" />
|
||||
<TextBlock Text="{Binding SpeedText}" FontSize="11" Classes="status" HorizontalAlignment="Right" IsVisible="{Binding IsBusy}" />
|
||||
@@ -22,8 +25,10 @@
|
||||
</Grid>
|
||||
|
||||
<WrapPanel Grid.Row="1" Margin="0,0,0,10" ItemSpacing="8" LineSpacing="8">
|
||||
<Button Content="{Binding Localization[Btn_AddFiles]}" Command="{Binding AddFilesCommand}" ToolTip.Tip="Ctrl+O" />
|
||||
<Button Content="{Binding Localization[Btn_AddFolder]}" Command="{Binding AddFolderCommand}" ToolTip.Tip="Ctrl+Shift+O" />
|
||||
<Button Content="{Binding Localization[Btn_AddFiles]}" Command="{Binding AddFilesCommand}"
|
||||
ToolTip.Tip="{x:Static controls:Shortcuts.AddFiles}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.AddFiles}" />
|
||||
<Button Content="{Binding Localization[Btn_AddFolder]}" Command="{Binding AddFolderCommand}"
|
||||
ToolTip.Tip="{x:Static controls:Shortcuts.AddFolder}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.AddFolder}" />
|
||||
<Button Content="{Binding Localization[Btn_OpenChecksumFile]}" Command="{Binding OpenChecksumFileCommand}" IsEnabled="{Binding CanModify}" />
|
||||
<StackPanel Orientation="Horizontal" Spacing="6" IsEnabled="{Binding CanModify}">
|
||||
<TextBlock Text="{Binding Localization[Lbl_DefaultAlgorithm]}" VerticalAlignment="Center" />
|
||||
@@ -31,9 +36,11 @@
|
||||
AutomationProperties.Name="{Binding Localization[Lbl_DefaultAlgorithm]}" />
|
||||
</StackPanel>
|
||||
<Button x:Name="RunAllButton" Content="{Binding Localization[Btn_CheckAll]}" Classes="accent" Command="{Binding RunAllCommand}"
|
||||
IsVisible="{Binding !IsBusy}" ToolTip.Tip="Ctrl+Enter" controls:FocusHandOff.Target="{Binding #CancelButton}" />
|
||||
IsVisible="{Binding !IsBusy}" ToolTip.Tip="{x:Static controls:Shortcuts.RunAll}"
|
||||
AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.RunAll}" controls:FocusHandOff.Target="{Binding #CancelButton}" />
|
||||
<Button x:Name="CancelButton" Content="{Binding Localization[Btn_Cancel]}" Command="{Binding CancelCommand}" IsVisible="{Binding IsBusy}"
|
||||
ToolTip.Tip="Esc" controls:FocusHandOff.Target="{Binding #RunAllButton}" />
|
||||
ToolTip.Tip="{x:Static controls:Shortcuts.Cancel}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.Cancel}"
|
||||
controls:FocusHandOff.Target="{Binding #RunAllButton}" />
|
||||
<TextBlock Text="{Binding RemainingText}" VerticalAlignment="Center" FontWeight="SemiBold" IsVisible="{Binding IsBusy}" />
|
||||
<Button Content="{Binding Localization[Btn_Clear]}" Command="{Binding ClearListCommand}" IsVisible="{Binding HasItems}" />
|
||||
<Button Content="{Binding Localization[Btn_ClearHashes]}" Command="{Binding ClearResultsCommand}" IsVisible="{Binding HasItems}" />
|
||||
@@ -43,7 +50,7 @@
|
||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto,Auto" Margin="0,0,0,8" IsVisible="{Binding HasItems}">
|
||||
<TextBox x:Name="SearchBox" Text="{Binding SearchText}" PlaceholderText="{Binding Localization[Watermark_Search]}"
|
||||
MaxWidth="420" HorizontalAlignment="Left" MinWidth="200"
|
||||
AutomationProperties.Name="{Binding Localization[Watermark_Search]}" />
|
||||
AutomationProperties.Name="{Binding Localization[Watermark_Search]}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.Search}" />
|
||||
<ComboBox Grid.Column="1" ItemsSource="{Binding StatusFilterOptions}" SelectedItem="{Binding SelectedStatusFilter}"
|
||||
MinWidth="150" Margin="8,0,0,0" AutomationProperties.Name="{Binding Localization[Lbl_FilterStatus]}">
|
||||
<ComboBox.ItemTemplate>
|
||||
@@ -103,10 +110,10 @@
|
||||
<DataTemplate x:DataType="vm:FileItem">
|
||||
<Grid ColumnDefinitions="3*,Auto,5*,2*,Auto" Margin="0,2">
|
||||
<StackPanel VerticalAlignment="Center" Margin="0,0,10,0" ToolTip.Tip="{Binding FilePath}" MinWidth="140">
|
||||
<controls:HighlightTextBlock Text="{Binding FileName}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis"
|
||||
<controls:HighlightTextBlock Text="{Binding FileName}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" FlowDirection="LeftToRight"
|
||||
HighlightText="{Binding $parent[ListBox].((vm:CheckHashViewModel)DataContext).SearchText}"
|
||||
HighlightBrush="{DynamicResource SystemAccentColor}" />
|
||||
<TextBlock Text="{Binding DirectoryName}" FontSize="10" Classes="secondary" TextTrimming="LeadingCharacterEllipsis" />
|
||||
<TextBlock Text="{Binding DirectoryName}" FontSize="10" Classes="secondary" TextTrimming="LeadingCharacterEllipsis" FlowDirection="LeftToRight" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="0,0,10,0" MinWidth="86">
|
||||
@@ -116,10 +123,10 @@
|
||||
IsVisible="{Binding Duration, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Column="2" ColumnDefinitions="*,Auto,Auto" VerticalAlignment="Center" MinWidth="180" Margin="0,0,8,0">
|
||||
<Grid Grid.Column="2" ColumnDefinitions="*,Auto,Auto" RowDefinitions="Auto,Auto" VerticalAlignment="Center" MinWidth="180" Margin="0,0,8,0">
|
||||
<Panel>
|
||||
<!-- Masked display when hash masking is on and the row is not revealed. -->
|
||||
<TextBlock FontFamily="Consolas, Menlo, monospace" FontSize="11" VerticalAlignment="Center" Margin="6,0">
|
||||
<TextBlock FontFamily="Consolas, Menlo, monospace" FontSize="11" VerticalAlignment="Center" Margin="6,0" FlowDirection="LeftToRight">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource HashMaskConverter}">
|
||||
<Binding Path="ExpectedHash" />
|
||||
@@ -134,10 +141,10 @@
|
||||
</MultiBinding>
|
||||
</TextBlock.IsVisible>
|
||||
</TextBlock>
|
||||
<TextBox Classes="hashInput" Text="{Binding ExpectedHash}" FontFamily="Consolas, Menlo, monospace" FontSize="11"
|
||||
<TextBox Classes="hashInput" Text="{Binding ExpectedHash}" FontFamily="Consolas, Menlo, monospace" FontSize="11" FlowDirection="LeftToRight"
|
||||
PlaceholderText="{Binding $parent[ListBox].((vm:CheckHashViewModel)DataContext).Localization[Watermark_PasteDrop]}"
|
||||
DragDrop.AllowDrop="True" VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{Binding $parent[ListBox].((vm:CheckHashViewModel)DataContext).Localization[Watermark_PasteDrop]}">
|
||||
AutomationProperties.Name="{Binding $parent[ListBox].((vm:CheckHashViewModel)DataContext).Localization[Lbl_ExpectedHash]}">
|
||||
<TextBox.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.Or}">
|
||||
<Binding Path="!$parent[Window].((vm:MainWindowViewModel)DataContext).IsHashMaskingEnabled" />
|
||||
@@ -164,13 +171,35 @@
|
||||
AutomationProperties.Name="{Binding $parent[ListBox].((vm:CheckHashViewModel)DataContext).Localization[Tip_BrowseHash]}">
|
||||
<icons:MaterialIcon Kind="FileFind" Width="18" Height="18" Foreground="{DynamicResource StatusInfoBrush}" />
|
||||
</Button>
|
||||
<!-- On a mismatch, the hash the file really has, under the expected one: readable and focusable, not only
|
||||
in the status tooltip. -->
|
||||
<TextBox Grid.Row="1" Grid.ColumnSpan="3" IsReadOnly="True" FontFamily="Consolas, Menlo, monospace" FontSize="11"
|
||||
BorderThickness="0" Background="Transparent" TextWrapping="NoWrap" FlowDirection="LeftToRight"
|
||||
IsVisible="{Binding Status, Converter={x:Static conv:StatusSeverity.IsMismatch}}"
|
||||
ToolTip.Tip="{Binding $parent[ListBox].((vm:CheckHashViewModel)DataContext).Localization[Lbl_ComputedHash]}"
|
||||
AutomationProperties.Name="{Binding $parent[ListBox].((vm:CheckHashViewModel)DataContext).Localization[Lbl_ComputedHash]}">
|
||||
<TextBox.Text>
|
||||
<MultiBinding Converter="{StaticResource HashMaskConverter}">
|
||||
<Binding Path="ResultHash" />
|
||||
<Binding Path="$parent[Window].((vm:MainWindowViewModel)DataContext).IsHashMaskingEnabled" />
|
||||
<Binding Path="IsRevealed" />
|
||||
</MultiBinding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Column="3" Classes="status" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="12" FontWeight="SemiBold"
|
||||
ToolTip.Tip="{Binding ResultHash}"
|
||||
Classes.success="{Binding Status, Converter={x:Static conv:StatusSeverity.IsSuccess}}"
|
||||
Classes.error="{Binding Status, Converter={x:Static conv:StatusSeverity.IsError}}"
|
||||
Classes.warning="{Binding Status, Converter={x:Static conv:StatusSeverity.IsWarning}}">
|
||||
<!-- The computed hash, masked like everywhere else when hash masking is on. -->
|
||||
<ToolTip.Tip>
|
||||
<MultiBinding Converter="{StaticResource HashMaskConverter}">
|
||||
<Binding Path="ResultHash" />
|
||||
<Binding Path="$parent[Window].((vm:MainWindowViewModel)DataContext).IsHashMaskingEnabled" />
|
||||
<Binding Path="IsRevealed" />
|
||||
</MultiBinding>
|
||||
</ToolTip.Tip>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource StatusTextConverter}">
|
||||
<Binding Path="Status" />
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace HashTool.App.Views.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Keyboard shortcuts as tooltips show them and screen readers announce them (<c>AutomationProperties.AcceleratorKey</c>),
|
||||
/// in the notation of the platform: "Ctrl+Shift+O" on Windows and Linux, "⇧⌘O" on macOS, where Command takes the place
|
||||
/// of Ctrl (see the key bindings of MainWindow).
|
||||
/// </summary>
|
||||
public static class Shortcuts
|
||||
{
|
||||
public static string AddFiles { get; } = Format("Ctrl+O");
|
||||
|
||||
public static string AddFolder { get; } = Format("Ctrl+Shift+O");
|
||||
|
||||
public static string Search { get; } = Format("Ctrl+F");
|
||||
|
||||
public static string RunAll { get; } = Format("Ctrl+Enter");
|
||||
|
||||
public static string Cancel { get; } = Format("Esc");
|
||||
|
||||
internal static string Format(string gesture, bool macOS)
|
||||
{
|
||||
if (!macOS) return gesture;
|
||||
var parts = gesture.Split('+');
|
||||
var key = parts[^1] switch
|
||||
{
|
||||
"Enter" => "↩",
|
||||
var other => other
|
||||
};
|
||||
// macOS order: Control, Option, Shift, Command.
|
||||
return (parts.Contains("Alt") ? "⌥" : "") + (parts.Contains("Shift") ? "⇧" : "") + (parts.Contains("Ctrl") ? "⌘" : "") + key;
|
||||
}
|
||||
|
||||
private static string Format(string gesture) => Format(gesture, OperatingSystem.IsMacOS());
|
||||
}
|
||||
@@ -16,6 +16,9 @@
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Spacing="2">
|
||||
<TextBlock Text="{Binding TotalFilesText}" Classes="secondary" HorizontalAlignment="Right" IsVisible="{Binding !IsBusy}" />
|
||||
<!-- The result of a one-file run, announced by screen readers (a run of several files ends with a dialog). -->
|
||||
<TextBlock Text="{Binding Announcement}" FontWeight="SemiBold" HorizontalAlignment="Right" MaxWidth="420"
|
||||
TextTrimming="CharacterEllipsis" AutomationProperties.LiveSetting="Polite" />
|
||||
<TextBlock Text="{Binding ProgressText}" FontWeight="Bold" HorizontalAlignment="Right" IsVisible="{Binding IsBusy}" />
|
||||
<TextBlock Text="{Binding DetailText}" FontSize="11" HorizontalAlignment="Right" IsVisible="{Binding IsBusy}" />
|
||||
<TextBlock Text="{Binding SpeedText}" FontSize="11" Classes="status" HorizontalAlignment="Right" IsVisible="{Binding IsBusy}" />
|
||||
@@ -24,8 +27,10 @@
|
||||
|
||||
<!-- Toolbar -->
|
||||
<WrapPanel Grid.Row="1" Margin="0,0,0,10" ItemSpacing="8" LineSpacing="8">
|
||||
<Button Content="{Binding Localization[Btn_AddFiles]}" Command="{Binding AddFilesCommand}" ToolTip.Tip="Ctrl+O" />
|
||||
<Button Content="{Binding Localization[Btn_AddFolder]}" Command="{Binding AddFolderCommand}" ToolTip.Tip="Ctrl+Shift+O" />
|
||||
<Button Content="{Binding Localization[Btn_AddFiles]}" Command="{Binding AddFilesCommand}"
|
||||
ToolTip.Tip="{x:Static controls:Shortcuts.AddFiles}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.AddFiles}" />
|
||||
<Button Content="{Binding Localization[Btn_AddFolder]}" Command="{Binding AddFolderCommand}"
|
||||
ToolTip.Tip="{x:Static controls:Shortcuts.AddFolder}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.AddFolder}" />
|
||||
<StackPanel Orientation="Horizontal" Spacing="6" IsEnabled="{Binding CanModify}">
|
||||
<TextBlock Text="{Binding Localization[Lbl_Algorithm]}" VerticalAlignment="Center" />
|
||||
<ComboBox ItemsSource="{Binding Algorithms}" SelectedItem="{Binding SelectedAlgorithm}" MinWidth="130"
|
||||
@@ -45,9 +50,11 @@
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
<Button x:Name="RunAllButton" Content="{Binding Localization[Btn_CalcAll]}" Classes="accent" Command="{Binding RunAllCommand}"
|
||||
IsVisible="{Binding !IsBusy}" ToolTip.Tip="Ctrl+Enter" controls:FocusHandOff.Target="{Binding #CancelButton}" />
|
||||
IsVisible="{Binding !IsBusy}" ToolTip.Tip="{x:Static controls:Shortcuts.RunAll}"
|
||||
AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.RunAll}" controls:FocusHandOff.Target="{Binding #CancelButton}" />
|
||||
<Button x:Name="CancelButton" Content="{Binding Localization[Btn_Cancel]}" Command="{Binding CancelCommand}" IsVisible="{Binding IsBusy}"
|
||||
ToolTip.Tip="Esc" controls:FocusHandOff.Target="{Binding #RunAllButton}" />
|
||||
ToolTip.Tip="{x:Static controls:Shortcuts.Cancel}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.Cancel}"
|
||||
controls:FocusHandOff.Target="{Binding #RunAllButton}" />
|
||||
<TextBlock Text="{Binding RemainingText}" VerticalAlignment="Center" FontWeight="SemiBold" IsVisible="{Binding IsBusy}" />
|
||||
<Button Content="{Binding Localization[Btn_Clear]}" Command="{Binding ClearListCommand}" IsVisible="{Binding HasItems}" />
|
||||
<Button Content="{Binding Localization[Btn_ClearHashes]}" Command="{Binding ClearResultsCommand}" IsVisible="{Binding HasItems}" />
|
||||
@@ -58,7 +65,7 @@
|
||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto,Auto" Margin="0,0,0,8" IsVisible="{Binding HasItems}">
|
||||
<TextBox x:Name="SearchBox" Text="{Binding SearchText}" PlaceholderText="{Binding Localization[Watermark_Search]}"
|
||||
MaxWidth="420" HorizontalAlignment="Left" MinWidth="200"
|
||||
AutomationProperties.Name="{Binding Localization[Watermark_Search]}" />
|
||||
AutomationProperties.Name="{Binding Localization[Watermark_Search]}" AutomationProperties.AcceleratorKey="{x:Static controls:Shortcuts.Search}" />
|
||||
<ComboBox Grid.Column="1" ItemsSource="{Binding StatusFilterOptions}" SelectedItem="{Binding SelectedStatusFilter}"
|
||||
MinWidth="150" Margin="8,0,0,0" AutomationProperties.Name="{Binding Localization[Lbl_FilterStatus]}">
|
||||
<ComboBox.ItemTemplate>
|
||||
@@ -119,10 +126,10 @@
|
||||
<DataTemplate x:DataType="vm:FileItem">
|
||||
<Grid ColumnDefinitions="3*,Auto,Auto,4*,2*,Auto" Margin="0,2">
|
||||
<StackPanel VerticalAlignment="Center" Margin="0,0,10,0" ToolTip.Tip="{Binding FilePath}" MinWidth="140">
|
||||
<controls:HighlightTextBlock Text="{Binding FileName}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis"
|
||||
<controls:HighlightTextBlock Text="{Binding FileName}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" FlowDirection="LeftToRight"
|
||||
HighlightText="{Binding $parent[ListBox].((vm:CreateHashViewModel)DataContext).SearchText}"
|
||||
HighlightBrush="{DynamicResource SystemAccentColor}" />
|
||||
<TextBlock Text="{Binding DirectoryName}" FontSize="10" Classes="secondary" TextTrimming="LeadingCharacterEllipsis" />
|
||||
<TextBlock Text="{Binding DirectoryName}" FontSize="10" Classes="secondary" TextTrimming="LeadingCharacterEllipsis" FlowDirection="LeftToRight" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="0,0,10,0" MinWidth="76">
|
||||
@@ -144,7 +151,7 @@
|
||||
|
||||
<Grid Grid.Column="3" ColumnDefinitions="*,Auto,Auto" VerticalAlignment="Center" MinWidth="160">
|
||||
<Panel>
|
||||
<TextBox IsReadOnly="True" FontFamily="Consolas, Menlo, monospace" FontSize="11" BorderThickness="0"
|
||||
<TextBox IsReadOnly="True" FontFamily="Consolas, Menlo, monospace" FontSize="11" BorderThickness="0" FlowDirection="LeftToRight"
|
||||
Background="Transparent" TextWrapping="NoWrap" IsVisible="{Binding !ShowProgress}"
|
||||
AutomationProperties.Name="{Binding $parent[ListBox].((vm:CreateHashViewModel)DataContext).Localization[Lbl_HashValue]}">
|
||||
<TextBox.Text>
|
||||
|
||||
@@ -456,7 +456,7 @@
|
||||
<ToggleButton IsChecked="{Binding ShowConfigPath}" Content="{Binding Localization[Settings_ShowPath]}" />
|
||||
</StackPanel>
|
||||
<Grid ColumnDefinitions="*,Auto" Width="360" IsVisible="{Binding ShowConfigPath}">
|
||||
<TextBox Text="{Binding ConfigFilePath, Mode=OneWay}" IsReadOnly="True" Margin="0,0,6,0"
|
||||
<TextBox Text="{Binding ConfigFilePath, Mode=OneWay}" IsReadOnly="True" Margin="0,0,6,0" FlowDirection="LeftToRight"
|
||||
AutomationProperties.Name="{Binding Localization[Settings_ConfigPath]}" />
|
||||
<Button Grid.Column="1" Classes="icon" Command="{Binding CopyConfigPathCommand}"
|
||||
ToolTip.Tip="{Binding Localization[Tip_CopyPath]}"
|
||||
|
||||
@@ -17,6 +17,7 @@ using HashTool.App.Services;
|
||||
using HashTool.App.Services.Theme;
|
||||
using HashTool.App.ViewModels;
|
||||
using HashTool.App.Views;
|
||||
using HashTool.App.Views.Controls;
|
||||
using HashTool.Core.Configuration;
|
||||
using HashTool.Core.Tests;
|
||||
using Xunit;
|
||||
@@ -222,6 +223,70 @@ public sealed class AccessibilityTests
|
||||
list.IsBusy = false;
|
||||
}
|
||||
|
||||
[AvaloniaFact]
|
||||
public async Task HashesAndPaths_StayLeftToRight_InRightToLeftLanguages()
|
||||
{
|
||||
await using var screen = await Screen.ShowAsync();
|
||||
screen.Localization.SelectedLanguage = screen.Localization.Find("ar");
|
||||
var problems = new List<string>();
|
||||
foreach (var page in new[] { "Create", "Check", "Text" })
|
||||
{
|
||||
screen.Navigate(page);
|
||||
Assert.Equal(FlowDirection.RightToLeft, screen.Window.FlowDirection);
|
||||
// File names, folders and hash boxes (the read-only ones and Verify's expected hash); not the search box or
|
||||
// the text to hash, which hold text in the user's language.
|
||||
var targets = screen.Window.GetVisualDescendants().OfType<Control>()
|
||||
.Where(c => c.IsEffectivelyVisible && c.TemplatedParent is null && c switch
|
||||
{
|
||||
HighlightTextBlock => true,
|
||||
TextBlock block => ReferenceEquals(block.TextTrimming, TextTrimming.LeadingCharacterEllipsis),
|
||||
TextBox box => box.IsReadOnly || box.Classes.Contains("hashInput"),
|
||||
_ => false
|
||||
})
|
||||
.ToList();
|
||||
Assert.NotEmpty(targets);
|
||||
problems.AddRange(targets.Where(c => c.FlowDirection != FlowDirection.LeftToRight).Select(c => $"{page}: {Describe(c)}"));
|
||||
}
|
||||
|
||||
Assert.True(problems.Count == 0, string.Join(Environment.NewLine, problems));
|
||||
}
|
||||
|
||||
[AvaloniaFact]
|
||||
public async Task AMismatch_ShowsTheComputedHashInAFocusableBox_AndAnnouncesTheResult()
|
||||
{
|
||||
await using var screen = await Screen.ShowAsync();
|
||||
screen.Navigate("Check");
|
||||
var alpha = screen.Check.Items.Single(i => i.FileName == "alpha.txt");
|
||||
alpha.ExpectedHash = new string('0', 64);
|
||||
|
||||
await screen.Check.RunItemCommand.ExecuteAsync(alpha);
|
||||
await Wait.UntilAsync(() => alpha.Status == ItemStatus.Mismatch && !screen.Check.IsBusy);
|
||||
screen.Settle();
|
||||
|
||||
var name = screen.Localization["Lbl_ComputedHash"];
|
||||
var computed = screen.Window.GetVisualDescendants().OfType<TextBox>()
|
||||
.Single(t => t.IsEffectivelyVisible && AutomationProperties.GetName(t) == name);
|
||||
Assert.True(computed.Focusable && computed.IsReadOnly);
|
||||
Assert.Equal(alpha.ResultHash, computed.Text);
|
||||
Assert.Contains(screen.Window.GetVisualDescendants().OfType<TextBox>(),
|
||||
t => t.Classes.Contains("hashInput") && AutomationProperties.GetName(t) == screen.Localization["Lbl_ExpectedHash"]);
|
||||
|
||||
// One file: no summary dialog, the result goes to the page's live text instead.
|
||||
var expected = screen.Localization.Format("Msg_RowResult", "alpha.txt", screen.Localization["Status_Invalid"]);
|
||||
Assert.Equal(expected, screen.Check.Announcement);
|
||||
var live = screen.Window.GetVisualDescendants().OfType<TextBlock>().Single(t => t.Text == expected);
|
||||
Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(live));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Ctrl+O", false, "Ctrl+O")]
|
||||
[InlineData("Ctrl+O", true, "⌘O")]
|
||||
[InlineData("Ctrl+Shift+O", true, "⇧⌘O")]
|
||||
[InlineData("Ctrl+Enter", true, "⌘↩")]
|
||||
[InlineData("Esc", true, "Esc")]
|
||||
public void Shortcuts_UseThePlatformsNotation(string gesture, bool macOS, string expected) =>
|
||||
Assert.Equal(expected, Shortcuts.Format(gesture, macOS));
|
||||
|
||||
private static Color Opaque(IBrush brush, Color under)
|
||||
{
|
||||
var color = ((ISolidColorBrush)brush).Color;
|
||||
|
||||
@@ -57,6 +57,24 @@ public sealed class CreateHashViewModelTests
|
||||
private const string HelloSha256 = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824";
|
||||
private const string HelloMd5 = "5d41402abc4b2a76b9719d911017c592";
|
||||
|
||||
[AvaloniaFact]
|
||||
public async Task ARunOfOneFile_IsAnnounced_ARunOfSeveralShowsTheSummaryInstead()
|
||||
{
|
||||
using var page = new CreatePage();
|
||||
var localization = TestServices.Localization;
|
||||
|
||||
await page.HashAsync(("one.txt", "hello"));
|
||||
Assert.Equal(localization.Format("Msg_RowResult", "one.txt", localization["Status_Done"]), page.Vm.Announcement);
|
||||
Assert.Empty(page.Dialogs.Shown);
|
||||
|
||||
await page.HashAsync(("two.txt", "hello"));
|
||||
Assert.Null(page.Vm.Announcement);
|
||||
Assert.Single(page.Dialogs.Shown);
|
||||
|
||||
await page.Vm.ClearListCommand.ExecuteAsync(null);
|
||||
Assert.Null(page.Vm.Announcement);
|
||||
}
|
||||
|
||||
[AvaloniaFact]
|
||||
public async Task ExportsOneChecksumFile_WithPathsRelativeToIt()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user