Improve Accessibility Reliability (#2609)

* Remove WindowUiaProvider entry points
Make TerminalAutomationPeer not crash the app if creation failed.

* code format

* prefer universal initialization

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>
This commit is contained in:
Carlos Zamora 2019-09-23 08:59:03 -07:00 committed by GitHub
parent bfb1484708
commit 6b415126fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 3 deletions

View file

@ -342,9 +342,15 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
Windows::UI::Xaml::Automation::Peers::AutomationPeer TermControl::OnCreateAutomationPeer() Windows::UI::Xaml::Automation::Peers::AutomationPeer TermControl::OnCreateAutomationPeer()
{ {
// create a custom automation peer with this code pattern: Windows::UI::Xaml::Automation::Peers::AutomationPeer autoPeer{ nullptr };
// (https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers) try
return winrt::make<winrt::Microsoft::Terminal::TerminalControl::implementation::TermControlAutomationPeer>(*this); {
// create a custom automation peer with this code pattern:
// (https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers)
autoPeer = winrt::make<winrt::Microsoft::Terminal::TerminalControl::implementation::TermControlAutomationPeer>(*this);
}
CATCH_LOG();
return autoPeer;
} }
::Microsoft::Console::Types::IUiaData* TermControl::GetUiaData() const ::Microsoft::Console::Types::IUiaData* TermControl::GetUiaData() const

View file

@ -56,13 +56,24 @@ public:
return HandleDpiChange(_window.get(), wparam, lparam); return HandleDpiChange(_window.get(), wparam, lparam);
} }
// TODO GitHub #2447: Properly attach WindowUiaProvider for signaling model
/*
case WM_GETOBJECT: case WM_GETOBJECT:
{ {
return HandleGetObject(_window.get(), wparam, lparam); return HandleGetObject(_window.get(), wparam, lparam);
} }
*/
case WM_DESTROY: case WM_DESTROY:
{ {
// TODO GitHub #2447: Properly attach WindowUiaProvider for signaling model
/*
// signal to uia that they can disconnect our uia provider
if (_pUiaProvider)
{
UiaReturnRawElementProvider(hWnd, 0, 0, NULL);
}
*/
PostQuitMessage(0); PostQuitMessage(0);
return 0; return 0;
} }

View file

@ -161,6 +161,16 @@ void IslandWindow::OnSize(const UINT width, const UINT height)
{ {
if (_interopWindowHandle != nullptr) if (_interopWindowHandle != nullptr)
{ {
// TODO GitHub #2447: Properly attach WindowUiaProvider for signaling model
/*
// set the text area to have focus for accessibility consumers
if (_pUiaProvider)
{
LOG_IF_FAILED(_pUiaProvider->SetTextAreaFocus());
}
break;
*/
// send focus to the child window // send focus to the child window
SetFocus(_interopWindowHandle); SetFocus(_interopWindowHandle);
return 0; // eat the message return 0; // eat the message