Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make screen reader announce successful MovePane and MoveTab actions #15771

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/cascadia/TerminalApp/AppActionHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "../WinRTUtils/inc/WtExeUtils.h"
#include "../../types/inc/utils.hpp"
#include "Utils.h"
#include <LibraryResources.h>
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved

using namespace winrt::Windows::ApplicationModel::DataTransfer;
using namespace winrt::Windows::UI::Xaml;
Expand Down Expand Up @@ -209,7 +210,17 @@ namespace winrt::TerminalApp::implementation
}
else if (const auto& realArgs = args.ActionArgs().try_as<MovePaneArgs>())
{
auto moved = _MovePane(realArgs);
const auto moved = _MovePane(realArgs);
if (moved)
{
if (auto autoPeer = Automation::Peers::FrameworkElementAutomationPeer::FromElement(*this))
{
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
RS_(L"TerminalPage_PaneMovedAnnouncement"),
L"TerminalPageMovePane" /* unique name for this notification category */);
}
}
args.Handled(moved);
}
}
Expand Down Expand Up @@ -813,6 +824,16 @@ namespace winrt::TerminalApp::implementation
if (const auto& realArgs = actionArgs.ActionArgs().try_as<MoveTabArgs>())
{
auto moved = _MoveTab(realArgs);
if (moved)
{
if (auto autoPeer = Automation::Peers::FrameworkElementAutomationPeer::FromElement(*this))
{
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
RS_(L"TerminalPage_TabMovedAnnouncement"),
L"TerminalPageMoveTab" /* unique name for this notification category */);
}
}
actionArgs.Handled(moved);
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -840,4 +840,10 @@
<value>Run as Administrator</value>
<comment>This text is displayed on context menu for profile entries in add new tab button.</comment>
</data>
</root>
<data name="TerminalPage_PaneMovedAnnouncement" xml:space="preserve">
<value>Pane moved successfully</value>
</data>
<data name="TerminalPage_TabMovedAnnouncement" xml:space="preserve">
<value>Tab moved successfully</value>
</data>
</root>
5 changes: 5 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ namespace winrt::TerminalApp::implementation
ShowSetAsDefaultInfoBar();
}

Windows::UI::Xaml::Automation::Peers::AutomationPeer TerminalPage::OnCreateAutomationPeer()
{
return Automation::Peers::FrameworkElementAutomationPeer(*this);
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved
}

// Method Description:
// - This is a bit of trickiness: If we're running unelevated, and the user
// passed in only --elevate actions, the we don't _actually_ want to
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/TerminalPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ namespace winrt::TerminalApp::implementation
void SetSettings(Microsoft::Terminal::Settings::Model::CascadiaSettings settings, bool needRefreshUI);

void Create();
Windows::UI::Xaml::Automation::Peers::AutomationPeer OnCreateAutomationPeer();

bool ShouldImmediatelyHandoffToElevated(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
void HandoffToElevated(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings);
Expand Down