From 1b393c29f55ceb8fd654ce152ea6c05ba9b1ba7a Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Wed, 26 Jan 2022 14:32:28 -0800 Subject: [PATCH] [Command Palette] Announce if suggestions were found to screen readers --- src/cascadia/TerminalApp/CommandPalette.cpp | 15 ++++++--------- .../TerminalApp/Resources/en-US/Resources.resw | 5 ++++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index a4b4c0b8f18..10578822c1e 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -822,16 +822,13 @@ namespace winrt::TerminalApp::implementation { const auto currentNeedleHasResults{ _filteredActions.Size() > 0 }; _noMatchesText().Visibility(currentNeedleHasResults ? Visibility::Collapsed : Visibility::Visible); - if (!currentNeedleHasResults) + if (auto automationPeer{ Automation::Peers::FrameworkElementAutomationPeer::FromElement(_searchBox()) }) { - if (auto automationPeer{ Automation::Peers::FrameworkElementAutomationPeer::FromElement(_searchBox()) }) - { - automationPeer.RaiseNotificationEvent( - Automation::Peers::AutomationNotificationKind::ActionCompleted, - Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, - NoMatchesText(), // NoMatchesText contains the right text for the current mode - L"CommandPaletteResultAnnouncement" /* unique name for this notification */); - } + automationPeer.RaiseNotificationEvent( + Automation::Peers::AutomationNotificationKind::ActionCompleted, + Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, + currentNeedleHasResults ? RS_(L"CommandPalette_MatchesAvailable") : NoMatchesText(), // what to announce if results were found + L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */); } } else diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 88dd2624e1a..0c3bd45d6a5 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -725,4 +725,7 @@ Open Settings This is a call-to-action hyperlink; it will open the settings. - + + Suggestions available + + \ No newline at end of file