diff options
author | Bret Johnson <bret.johnson@microsoft.com> | 2018-07-09 08:41:27 +0300 |
---|---|---|
committer | Bret Johnson <bret.johnson@microsoft.com> | 2018-07-09 08:46:50 +0300 |
commit | 973c6d3eb93dede6887b7b673b5dfac54d13283e (patch) | |
tree | 9874912c8ae7ea21d8363889e2bdee4181ec11b0 | |
parent | 247a369189df640b35bea0860b4c1cd0eecff2df (diff) |
[a11y][WPF] Updated spinner automation peer
Now the automation peer for the spinner control
is returned both from the TextBox (when it has
the focus) and the outer UserControl. In both cases
the returned peer is for the outer control. With this,
the Narrator seems to work well with the spinner.
-rw-r--r-- | Xwt.WPF/Xwt.WPFBackend/WindowsSpinButton.xaml.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Xwt.WPF/Xwt.WPFBackend/WindowsSpinButton.xaml.cs b/Xwt.WPF/Xwt.WPFBackend/WindowsSpinButton.xaml.cs index cb212fa4..5adf6bb5 100644 --- a/Xwt.WPF/Xwt.WPFBackend/WindowsSpinButton.xaml.cs +++ b/Xwt.WPF/Xwt.WPFBackend/WindowsSpinButton.xaml.cs @@ -459,6 +459,12 @@ namespace Xwt.WPFBackend #endregion #region Accessibility + + protected override AutomationPeer OnCreateAutomationPeer () + { + return new WindowsSpinButtonAutomationPeer (this); + } + class SpinButtonTextBox : TextBox { WindowsSpinButton spinButton; @@ -470,7 +476,7 @@ namespace Xwt.WPFBackend protected override AutomationPeer OnCreateAutomationPeer () { - return new WindowsSpinButtonAutomationPeer (spinButton); + return UIElementAutomationPeer.FromElement (spinButton); } } @@ -499,12 +505,12 @@ namespace Xwt.WPFBackend protected override bool IsKeyboardFocusableCore () { - return true; + return Button.IsEnabled; } protected override bool HasKeyboardFocusCore () { - return Button.TextBox.IsFocused; + return Button.IsKeyboardFocusWithin; } protected override void SetFocusCore () |