mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
only use the hack when Narrator is turn on
This commit is contained in:
parent
ee6efa379d
commit
029e781319
2 changed files with 14 additions and 3 deletions
|
@ -12,6 +12,7 @@ using namespace std;
|
|||
using namespace Windows::ApplicationModel;
|
||||
using namespace Windows::UI::Core;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Automation::Peers;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Text;
|
||||
|
@ -118,9 +119,12 @@ void MathRichEditBox::OnGotFocus(Platform::Object ^ sender, Windows::UI::Xaml::R
|
|||
// [BUG 28498627][GithubIssue #1380]
|
||||
// below directives on Selection are going to engage Narrator to announce the content of this richedit
|
||||
// this is a workaround since richedit doesn't announce its content automatically.
|
||||
if (IsUIAccessibilityVoiceOverRunning())
|
||||
{
|
||||
this->Document->Selection->EndKey(TextRangeUnit::Line, false);
|
||||
this->Document->Selection->HomeKey(TextRangeUnit::Line, false);
|
||||
this->Document->Selection->MoveLeft(TextRangeUnit::Character, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
void MathRichEditBox::OnLosingFocus(UIElement ^ sender, LosingFocusEventArgs ^ args)
|
||||
|
@ -238,3 +242,8 @@ void MathRichEditBox::SubmitEquation(EquationSubmissionSource source)
|
|||
EquationSubmitted(this, ref new MathRichEditBoxSubmission(false, source));
|
||||
}
|
||||
}
|
||||
|
||||
bool MathRichEditBox::IsUIAccessibilityVoiceOverRunning() const
|
||||
{
|
||||
return AutomationPeer::ListenerExists(AutomationEvents::PropertyChanged);
|
||||
}
|
||||
|
|
|
@ -70,6 +70,8 @@ namespace CalculatorApp
|
|||
void OnGotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnLosingFocus(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::LosingFocusEventArgs ^ args);
|
||||
void OnKeyUp(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e);
|
||||
|
||||
bool IsUIAccessibilityVoiceOverRunning() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue