Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding automation names to buttons #842

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Calculator/Controls/EquationTextBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ using namespace Windows::Foundation;
using namespace Windows::ApplicationModel;
using namespace Windows::UI::Text;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Automation;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Controls::Primitives;
Expand Down Expand Up @@ -50,8 +51,10 @@ void EquationTextBox::OnApplyTemplate()

auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = m_equationButton->IsChecked->Value ? resProvider->GetResourceString(L"showEquationButtonToolTip") : resProvider->GetResourceString(L"hideEquationButtonToolTip");
auto equationButtonMessage = m_equationButton->IsChecked->Value ? resProvider->GetResourceString(L"showEquationButtonToolTip") : resProvider->GetResourceString(L"hideEquationButtonToolTip");
toolTip->Content = equationButtonMessage;
ToolTipService::SetToolTip(m_equationButton, toolTip);
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
}

if (m_kgfEquationButton != nullptr)
Expand Down Expand Up @@ -190,9 +193,10 @@ void EquationTextBox::OnEquationButtonClicked(Object ^ sender, RoutedEventArgs ^

auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = m_equationButton->IsChecked->Value ? resProvider->GetResourceString(L"showEquationButtonToolTip") : resProvider->GetResourceString(L"hideEquationButtonToolTip");

auto equationButtonMessage = m_equationButton->IsChecked->Value ? resProvider->GetResourceString(L"showEquationButtonToolTip") : resProvider->GetResourceString(L"hideEquationButtonToolTip");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming since these are for narrator.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And for the below names.

toolTip->Content = equationButtonMessage;
ToolTipService::SetToolTip(m_equationButton, toolTip);
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
}

void EquationTextBox::OnKGFEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
Expand Down
50 changes: 39 additions & 11 deletions src/Calculator/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -4128,47 +4128,75 @@
</data>
<data name="equationAnalysisBack.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Back</value>
<comment>This is the tooltip contents for the back button in the equation analysis page in the graphing calculator</comment>
<comment>This is the tooltip for the back button in the equation analysis page in the graphing calculator</comment>
</data>
<data name="equationAnalysisBack.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Back</value>
<comment>This is the automation name for the back button in the equation analysis page in the graphing calculator</comment>
</data>
<data name="functionAnalysisButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Analyze equation</value>
<comment>This is the tooltip automation name for the analyze equation button</comment>
<comment>This is the tooltip for the analyze equation button</comment>
</data>
<data name="functionAnalysisButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Analyze equation</value>
<comment>This is the automation name for the analyze equation button</comment>
</data>
<data name="removeButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Remove equation</value>
<comment>This is the tool tip automation name for the graphing calculator remove equation buttons</comment>
<comment>This is the tooltip for the graphing calculator remove equation buttons</comment>
</data>
<data name="removeButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Remove equation</value>
<comment>This is the automation name for the graphing calculator remove equation buttons</comment>
</data>
<data name="shareButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Share</value>
<comment>This is the tool tip automation name for the graphing calculator share button.</comment>
<comment>This is the automation name for the graphing calculator share button.</comment>
</data>
<data name="shareButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Share</value>
<comment>This is the tooltip for the graphing calculator share button.</comment>
</data>
<data name="colorChooserButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Change equation style</value>
<comment>This is the tool tip automation name for the graphing calculator equation style button</comment>
<comment>This is the tooltip for the graphing calculator equation style button</comment>
</data>
<data name="colorChooserButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Change equation style</value>
<comment>This is the automation name for the graphing calculator equation style button</comment>
</data>
<data name="showEquationButtonToolTip" xml:space="preserve">
<value>Show</value>
<comment>This is the tooltip shown when visibility is set to hidden in the graphing calculator</comment>
<comment>This is the tooltip/automation name shown when visibility is set to hidden in the graphing calculator</comment>
</data>
<data name="hideEquationButtonToolTip" xml:space="preserve">
<value>Hide</value>
<comment>This is the tooltip shown when visibility is set to visible in the graphing calculator</comment>
<comment>This is the tooltip/automation name shown when visibility is set to visible in the graphing calculator</comment>
</data>
<data name="disableTracingButtonToolTip" xml:space="preserve">
<value>Stop tracing</value>
<comment>This is the tool tip automation name for the graphing calculator stop tracing button</comment>
<comment>This is the tooltip/automation name for the graphing calculator stop tracing button</comment>
</data>
<data name="enableTracingButtonToolTip" xml:space="preserve">
<value>Start tracing</value>
<comment>This is the tool tip automation name for the graphing calculator start tracing button</comment>
<comment>This is the tooltip/automation name for the graphing calculator start tracing button</comment>
</data>
<data name="variablesButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Variables</value>
<comment>This is the tool tip automation name for the Calculator variables button.</comment>
<comment>This is the tooltip for the Calculator variables button.</comment>
</data>
<data name="variablesButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Variables</value>
<comment>This is the automation name for the Calculator variables button.</comment>
</data>
<data name="sliderOptionsButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Configure slider</value>
<comment>This is the tool tip text for teh slider options button in Graphing Calculator</comment>
<comment>This is the tooltip text for the slider options button in Graphing Calculator</comment>
</data>
<data name="sliderOptionsButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Configure slider</value>
<comment>This is the automation name text for the slider options button in Graphing Calculator</comment>
</data>
<data name="GraphSwitchToEquationMode" xml:space="preserve">
<value>Switch to equation mode</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@
<TranslateTransform x:Name="TraceValuePopupTransform"/>
</Border.RenderTransform>
<TextBlock x:Name="TraceValue"
AutomationProperties.LiveSetting="Polite"
Foreground="{ThemeResource ToolTipForeground}"
Text="x=0,y=0"/>
</Border>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ using namespace Windows::System;
using namespace Windows::UI::Core;
using namespace Windows::UI::Input;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Automation;
using namespace Windows::UI::Xaml::Automation::Peers;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Input;
Expand All @@ -58,8 +60,10 @@ GraphingCalculator::GraphingCalculator()

auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = ActiveTracingOn ? resProvider->GetResourceString(L"disableTracingButtonToolTip") : resProvider->GetResourceString(L"enableTracingButtonToolTip");
auto tracingMessage = ActiveTracingOn ? resProvider->GetResourceString(L"disableTracingButtonToolTip") : resProvider->GetResourceString(L"enableTracingButtonToolTip");
toolTip->Content = tracingMessage;
ToolTipService::SetToolTip(ActiveTracing, toolTip);
AutomationProperties::SetName(ActiveTracing, tracingMessage);

DataTransferManager ^ dataTransferManager = DataTransferManager::GetForCurrentView();

Expand Down Expand Up @@ -126,6 +130,14 @@ void GraphingCalculator::OnEquationsVectorChanged(IObservableVector<EquationView
void GraphingCalculator::OnTracePointChanged(Windows::Foundation::Point newPoint)
{
TraceValue->Text = "(" + newPoint.X.ToString() + ", " + newPoint.Y.ToString() + ")";

auto peer = FrameworkElementAutomationPeer::FromElement(TraceValue);

if (peer != nullptr)
{
peer->RaiseAutomationEvent(AutomationEvents::LiveRegionChanged);
}

PositionGraphPopup();
}

Expand Down Expand Up @@ -349,8 +361,10 @@ void GraphingCalculator::OnActiveTracingClick(Object ^ sender, RoutedEventArgs ^

auto toolTip = ref new ToolTip();
auto resProvider = AppResourceProvider::GetInstance();
toolTip->Content = ActiveTracingOn ? resProvider->GetResourceString(L"disableTracingButtonToolTip") : resProvider->GetResourceString(L"enableTracingButtonToolTip");
auto tracingMessage = ActiveTracingOn ? resProvider->GetResourceString(L"disableTracingButtonToolTip") : resProvider->GetResourceString(L"enableTracingButtonToolTip");
toolTip->Content = tracingMessage;
ToolTipService::SetToolTip(ActiveTracing, toolTip);
AutomationProperties::SetName(ActiveTracing, tracingMessage);
}

void GraphingCalculator::GraphingControl_LostFocus(Object ^ sender, RoutedEventArgs ^ e)
Expand Down