From 4fb07d65eff9214ee5c6f4b1b9b68225fd864657 Mon Sep 17 00:00:00 2001 From: "Eric Wong (PAX)" Date: Mon, 2 Dec 2019 16:46:17 -0800 Subject: [PATCH 1/2] Add missing automation names for buttons in graphing calculator --- src/Calculator/Controls/EquationTextBox.cpp | 10 ++-- src/Calculator/Resources/en-US/Resources.resw | 50 +++++++++++++++---- .../GraphingCalculator.xaml.cpp | 9 +++- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/src/Calculator/Controls/EquationTextBox.cpp b/src/Calculator/Controls/EquationTextBox.cpp index 1b559f584..126488864 100644 --- a/src/Calculator/Controls/EquationTextBox.cpp +++ b/src/Calculator/Controls/EquationTextBox.cpp @@ -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) @@ -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"); + toolTip->Content = equationButtonMessage; ToolTipService::SetToolTip(m_equationButton, toolTip); + AutomationProperties::SetName(m_equationButton, equationButtonMessage); } void EquationTextBox::OnKGFEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e) diff --git a/src/Calculator/Resources/en-US/Resources.resw b/src/Calculator/Resources/en-US/Resources.resw index 215d54443..c81bb1238 100644 --- a/src/Calculator/Resources/en-US/Resources.resw +++ b/src/Calculator/Resources/en-US/Resources.resw @@ -3700,47 +3700,75 @@ Back - This is the tooltip contents for the back button in the equation analysis page in the graphing calculator + This is the tooltip for the back button in the equation analysis page in the graphing calculator + + + Back + This is the automation name for the back button in the equation analysis page in the graphing calculator Analyze equation - This is the tooltip automation name for the analyze equation button + This is the tooltip for the analyze equation button + + + Analyze equation + This is the automation name for the analyze equation button Remove equation - This is the tool tip automation name for the graphing calculator remove equation buttons + This is the tooltip for the graphing calculator remove equation buttons + + + Remove equation + This is the automation name for the graphing calculator remove equation buttons Share - This is the tool tip automation name for the graphing calculator share button. + This is the automation name for the graphing calculator share button. + + + Share + This is the tooltip for the graphing calculator share button. Change equation style - This is the tool tip automation name for the graphing calculator equation style button + This is the tooltip for the graphing calculator equation style button + + + Change equation style + This is the automation name for the graphing calculator equation style button Show - This is the tooltip shown when visibility is set to hidden in the graphing calculator + This is the tooltip/automation name shown when visibility is set to hidden in the graphing calculator Hide - This is the tooltip shown when visibility is set to visible in the graphing calculator + This is the tooltip/automation name shown when visibility is set to visible in the graphing calculator Stop tracing - This is the tool tip automation name for the graphing calculator stop tracing button + This is the tooltip/automation name for the graphing calculator stop tracing button Start tracing - This is the tool tip automation name for the graphing calculator start tracing button + This is the tooltip/automation name for the graphing calculator start tracing button Variables - This is the tool tip automation name for the Calculator variables button. + This is the tooltip for the Calculator variables button. + + + Variables + This is the automation name for the Calculator variables button. Configure slider - This is the tool tip text for teh slider options button in Graphing Calculator + This is the tooltip text for the slider options button in Graphing Calculator + + + Configure slider + This is the automation name text for the slider options button in Graphing Calculator Switch to equation mode diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp index a2b8ecc7e..c6e2c3631 100644 --- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp +++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp @@ -38,6 +38,7 @@ 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::Data; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Input; @@ -58,8 +59,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(); @@ -349,8 +352,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) From c3944c907462788f7591f2cb017b9092fbfe5a82 Mon Sep 17 00:00:00 2001 From: "Eric Wong (PAX)" Date: Tue, 3 Dec 2019 11:11:44 -0800 Subject: [PATCH 2/2] Add narrator support for tracing features --- .../Views/GraphingCalculator/GraphingCalculator.xaml | 1 + .../Views/GraphingCalculator/GraphingCalculator.xaml.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml index 213174581..2b6e4c359 100644 --- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml +++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml @@ -688,6 +688,7 @@ diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp index a89ce3215..6978e0543 100644 --- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp +++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cpp @@ -39,6 +39,7 @@ 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; @@ -129,6 +130,14 @@ void GraphingCalculator::OnEquationsVectorChanged(IObservableVectorText = "(" + newPoint.X.ToString() + ", " + newPoint.Y.ToString() + ")"; + + auto peer = FrameworkElementAutomationPeer::FromElement(TraceValue); + + if (peer != nullptr) + { + peer->RaiseAutomationEvent(AutomationEvents::LiveRegionChanged); + } + PositionGraphPopup(); }