-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Make screen reader announce successful MovePane and MoveTab actions #15771
Conversation
This complies with the letter of the requirement, but does it comply with the spirit of the requirement? What does it mean for it to have been "moved successfully"? |
Yeah, the associated bug isn't that descriptive. And I have trouble finding other apps that do this too (VS Code doesn't do it, and VS is notoriously noisy so I didn't bother to check), ugh. All the associated bug says (even in the video) is that we need to say that we've moved successfully. So, it seems like the requirement is just to tell the user that the action was executed successfully. @codeofdusk is there anything specific you'd expect the screen reader to say if you moved a tab or pane to another window? |
The announcements now include a bunch more info. For now, this should be in a good reviewable state though :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not allergic to the OnCreateAutomationPeer
change, but it scares me a little bit!
</data> | ||
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow" xml:space="preserve"> | ||
<value>Active pane moved to "{0}" tab in "{1}" window</value> | ||
<comment>{Locked="{0}"}{Locked="{1}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab the pane was moved to. {1} is the name of the window the pane was moved to.</comment> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you can also write {Locked="{0}","{1}"}
if (auto autoPeer = Automation::Peers::FrameworkElementAutomationPeer::FromElement(*this)) | ||
{ | ||
autoPeer.RaiseNotificationEvent(Automation::Peers::AutomationNotificationKind::ActionCompleted, | ||
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, | ||
RS_(L"TerminalPage_PaneMovedAnnouncement_NewTab"), | ||
L"TerminalPageMovePaneToNewTab" /* unique name for this notification category */); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to construct the peer every time? Is it just a getter and cheap to call? Should we cache it? (I think this could be figured out by checking if the pointer that's returned is always the same. In that case it's probably a cheap getter.)
You could consider abstracting the code away like so:
void TerminalPage::_raiseActionCompletedEventforUIA(const std::wstring_view& activityId, const std::wstring_view& displayString) {
using namespace ::winrt::Windows::UI::Xaml::Automation::Peers;
if (auto autoPeer = FrameworkElementAutomationPeer::FromElement(*this))
{
autoPeer.RaiseNotificationEvent(
AutomationNotificationKind::ActionCompleted,
AutomationNotificationProcessing::ImportantMostRecent,
displayString,
activityId);
}
}
So that the remaining code becomes:
_raiseActionCompletedEventforUIA(L"TerminalPageMovePaneToNewTab", RS_(L"TerminalPage_PaneMovedAnnouncement_NewTab"));
(etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW this shouldn't construct but get the one from XAML's internal cache
Uses the
RaiseNotificationEvent()
API from UIA automation peers to announce successfulMovePane
andMoveTab
actions. The announcements are localized in the resw file.Closes #15159
Based on #13575