Skip to content

Commit

Permalink
apply feedback; don't apply AP to panels
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Oct 12, 2022
1 parent 9b57cd3 commit 99ceaf5
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/cascadia/TerminalSettingsEditor/SettingContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_UpdateOverrideSystem();

// Get the correct base to apply automation properties to
std::vector<DependencyObject> base(2, nullptr);
std::vector<DependencyObject> base;
base.reserve(2);
if (const auto& child{ GetTemplateChild(L"Expander") })
{
if (const auto& expander{ child.try_as<Microsoft::UI::Xaml::Controls::Expander>() })
Expand All @@ -143,36 +144,35 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
if (const auto& content{ Content() })
{
if (const auto& obj{ content.try_as<DependencyObject>() })
const auto& panel{ content.try_as<Controls::Panel>() };
const auto& obj{ content.try_as<DependencyObject>() };
if (!panel && obj)
{
base.push_back(obj);
}
}

for (auto obj : base)
for (const auto& obj : base)
{
if (obj)
// apply header as name (automation property)
if (const auto& header{ Header() })
{
// apply header as name (automation property)
if (const auto& header{ Header() })
if (const auto headerText{ header.try_as<hstring>() })
{
if (const auto headerText{ header.try_as<hstring>() })
{
Automation::AutomationProperties::SetName(obj, *headerText);
}
Automation::AutomationProperties::SetName(obj, *headerText);
}
}

// apply help text as tooltip and full description (automation property)
if (const auto& helpText{ HelpText() }; !helpText.empty())
{
Controls::ToolTipService::SetToolTip(obj, box_value(helpText));
Automation::AutomationProperties::SetFullDescription(obj, helpText);
}
else
{
Controls::ToolTipService::SetToolTip(obj, nullptr);
Automation::AutomationProperties::SetFullDescription(obj, L"");
}
// apply help text as tooltip and full description (automation property)
if (const auto& helpText{ HelpText() }; !helpText.empty())
{
Controls::ToolTipService::SetToolTip(obj, box_value(helpText));
Automation::AutomationProperties::SetFullDescription(obj, helpText);
}
else
{
Controls::ToolTipService::SetToolTip(obj, nullptr);
Automation::AutomationProperties::SetFullDescription(obj, L"");
}
}

Expand Down

0 comments on commit 99ceaf5

Please sign in to comment.