diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp index 2fa0d14f25b..11ee518458a 100644 --- a/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp +++ b/src/cascadia/TerminalSettingsEditor/SettingContainer.cpp @@ -122,28 +122,40 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation _UpdateOverrideSystem(); - if (const auto& content{ Content() }) + // Get the correct base to apply automation properties to + DependencyObject base{ nullptr }; + if (const auto& child{ GetTemplateChild(L"Expander") }) + { + if (const auto& expander{ child.try_as() }) + { + base = child; + } + } + else if (const auto& content{ Content() }) { if (const auto& obj{ content.try_as() }) { - // apply header text as name (automation property) - if (const auto& header{ Header() }) - { - const auto headerText{ header.try_as() }; - if (headerText && !headerText->empty()) - { - Automation::AutomationProperties::SetName(obj, *headerText); - } - } + base = obj; + } + } - // apply help text as tooltip and full description (automation property) - const auto& helpText{ HelpText() }; - if (!helpText.empty()) + if (base) + { + // apply header as name (automation property) + if (const auto& header{ Header() }) + { + if (const auto headerText{ header.try_as() }) { - Controls::ToolTipService::SetToolTip(obj, box_value(helpText)); - Automation::AutomationProperties::SetFullDescription(obj, helpText); + Automation::AutomationProperties::SetName(base, *headerText); } } + + // apply help text as tooltip and full description (automation property) + if (const auto& helpText{ HelpText() }; !helpText.empty()) + { + Controls::ToolTipService::SetToolTip(base, box_value(helpText)); + Automation::AutomationProperties::SetFullDescription(base, helpText); + } } if (HelpText().empty()) diff --git a/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml b/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml index 5efb9a2ebb6..6552bc19872 100644 --- a/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml +++ b/src/cascadia/TerminalSettingsEditor/SettingContainerStyle.xaml @@ -142,7 +142,8 @@ -