Adding automation names to buttons (#842)

* Add missing automation names for buttons in graphing calculator

* Add narrator support for tracing features
This commit is contained in:
Eric Wong 2019-12-04 11:00:07 -08:00 committed by GitHub
parent 133df73d6a
commit 36327b73de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 16 deletions

View File

@ -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;
@ -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)
@ -191,9 +194,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");
toolTip->Content = equationButtonMessage;
ToolTipService::SetToolTip(m_equationButton, toolTip);
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
}
void EquationTextBox::OnKGFEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)

View File

@ -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>

View File

@ -687,6 +687,7 @@
<TranslateTransform x:Name="TraceValuePopupTransform"/>
</Border.RenderTransform>
<TextBlock x:Name="TraceValue"
AutomationProperties.LiveSetting="Polite"
Foreground="{ThemeResource ToolTipForeground}"
Text="x=0,y=0"/>
</Border>

View File

@ -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;
@ -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();
@ -156,6 +160,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();
}
@ -379,8 +391,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)