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); } }