From 121fb739fd50966af3cb17e52bdf756d82bd384a Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 11 Aug 2021 10:13:38 -0500 Subject: [PATCH] Initialize the padding for the Control UIA provider (#10874) ## Summary of the Pull Request This was missed in #10051. We need to make sure that the UIA provider can immediately know about the padding in the control, not just after the settings reload. ## PR Checklist * [x] Closes #9955.e * [x] Additionally, this just closes #9955. The only remaining box in there never repro'd, so probably wasn't even root caused by #9820. I think we can close that issue for now, and reactivate if something else was broken. * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed Checked before/after in Accessibility Insights. Before the row rectangles were the full width of the control initially. Now they're properly padded. --- src/cascadia/TerminalControl/TermControl.cpp | 8 +++++++- .../TerminalControl/TermControlAutomationPeer.cpp | 3 ++- src/cascadia/TerminalControl/TermControlAutomationPeer.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 238d75c90..8d477fadf 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -517,7 +517,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation // (https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers) if (const auto& interactivityAutoPeer{ _interactivity.OnCreateAutomationPeer() }) { - _automationPeer = winrt::make(this, interactivityAutoPeer); + auto margins{ SwapChainPanel().Margin() }; + + Core::Padding padding{ margins.Left, + margins.Top, + margins.Right, + margins.Bottom }; + _automationPeer = winrt::make(this, padding, interactivityAutoPeer); return _automationPeer; } } diff --git a/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp b/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp index 730064476..3cfae1cce 100644 --- a/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp +++ b/src/cascadia/TerminalControl/TermControlAutomationPeer.cpp @@ -31,13 +31,14 @@ namespace XamlAutomation namespace winrt::Microsoft::Terminal::Control::implementation { TermControlAutomationPeer::TermControlAutomationPeer(TermControl* owner, + const Core::Padding padding, Control::InteractivityAutomationPeer impl) : TermControlAutomationPeerT(*owner), // pass owner to FrameworkElementAutomationPeer _termControl{ owner }, _contentAutomationPeer{ impl } { UpdateControlBounds(); - + SetControlPadding(padding); // Listen for UIA signalling events from the implementation. We need to // be the one to actually raise these automation events, so they go // through the UI tree correctly. diff --git a/src/cascadia/TerminalControl/TermControlAutomationPeer.h b/src/cascadia/TerminalControl/TermControlAutomationPeer.h index 0b81ebafe..e5a2cc7ff 100644 --- a/src/cascadia/TerminalControl/TermControlAutomationPeer.h +++ b/src/cascadia/TerminalControl/TermControlAutomationPeer.h @@ -43,6 +43,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation { public: TermControlAutomationPeer(Microsoft::Terminal::Control::implementation::TermControl* owner, + const Core::Padding padding, Control::InteractivityAutomationPeer implementation); void UpdateControlBounds();