From 0f1ce9021507d4035ef231cef1fb00ca5c49860e Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Fri, 4 Nov 2022 12:13:59 -0700 Subject: [PATCH] Apply AutoProps to TextBox settings in SUI (#14178) We already were setting the automation properties on the expander, however, we were not setting it on the content when an expander was present. This change applies the automation properties to both the expander and the child content (i.e. TextBox). Closes #13827 (cherry picked from commit 62b34cf6f77199df306999f89a5f57368cfa5059) Service-Card-Id: 87207143 Service-Version: 1.15 --- .../SettingContainer.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp index ab82dece2fb..6d99ddfc9b5 100644 --- a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp +++ b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp @@ -123,37 +123,40 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation _UpdateOverrideSystem(); // Get the correct base to apply automation properties to - DependencyObject base{ nullptr }; + std::vector base; + base.reserve(2); if (const auto& child{ GetTemplateChild(L"Expander") }) { if (const auto& expander{ child.try_as() }) { - base = child; + base.push_back(child); } } - else if (const auto& content{ Content() }) + if (const auto& content{ Content() }) { - if (const auto& obj{ content.try_as() }) + const auto& panel{ content.try_as() }; + const auto& obj{ content.try_as() }; + if (!panel && obj) { - base = obj; + base.push_back(obj); } } - if (base) + for (const auto& obj : base) { // apply header as name (automation property) if (const auto& header{ Header() }) { if (const auto headerText{ header.try_as() }) { - Automation::AutomationProperties::SetName(base, *headerText); + Automation::AutomationProperties::SetName(obj, *headerText); } } // apply help text as tooltip and full description (automation property) if (const auto& helpText{ HelpText() }; !helpText.empty()) { - Automation::AutomationProperties::SetFullDescription(base, helpText); + Automation::AutomationProperties::SetFullDescription(obj, helpText); } }