From 05f131595c5633eee5e8cd83add16613667ca5fd Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 9 Jun 2015 21:59:28 +0200 Subject: [PATCH] Make keyboard navigation handler per-window. Use the same pattern as AccessKeyHander. --- Perspex.Application/Application.cs | 4 +- Perspex.Controls/TopLevel.cs | 19 + Perspex.Input/AccessKeyHandler.cs | 8 +- Perspex.Input/IInputRoot.cs | 5 + Perspex.Input/IKeyboardNavigation.cs | 21 - Perspex.Input/IKeyboardNavigationHandler.cs | 35 ++ Perspex.Input/InputElement.cs | 15 - Perspex.Input/KeyboardNavigation.cs | 303 ++------------- Perspex.Input/KeyboardNavigationHandler.cs | 362 ++++++++++++++++++ Perspex.Input/Perspex.Input.csproj | 3 +- .../KeyboardNavigationTests.cs | 44 +-- 11 files changed, 493 insertions(+), 326 deletions(-) delete mode 100644 Perspex.Input/IKeyboardNavigation.cs create mode 100644 Perspex.Input/IKeyboardNavigationHandler.cs create mode 100644 Perspex.Input/KeyboardNavigationHandler.cs diff --git a/Perspex.Application/Application.cs b/Perspex.Application/Application.cs index 6d9e854d0f..634b7f88c3 100644 --- a/Perspex.Application/Application.cs +++ b/Perspex.Application/Application.cs @@ -151,8 +151,6 @@ namespace Perspex /// protected virtual void RegisterServices() { - var keyboardNavigation = new KeyboardNavigation(); - this.FocusManager = new FocusManager(); this.InputManager = new InputManager(); @@ -161,7 +159,7 @@ namespace Perspex Locator.CurrentMutable.Register(() => this, typeof(IGlobalStyles)); Locator.CurrentMutable.Register(() => this.FocusManager, typeof(IFocusManager)); Locator.CurrentMutable.Register(() => this.InputManager, typeof(IInputManager)); - Locator.CurrentMutable.Register(() => keyboardNavigation, typeof(IKeyboardNavigation)); + Locator.CurrentMutable.Register(() => new KeyboardNavigationHandler(), typeof(IKeyboardNavigationHandler)); Locator.CurrentMutable.Register(() => this.styler, typeof(IStyler)); Locator.CurrentMutable.Register(() => new LayoutManager(), typeof(ILayoutManager)); Locator.CurrentMutable.Register(() => new RenderManager(), typeof(IRenderManager)); diff --git a/Perspex.Controls/TopLevel.cs b/Perspex.Controls/TopLevel.cs index 7d96da1f2b..0d32fb3c33 100644 --- a/Perspex.Controls/TopLevel.cs +++ b/Perspex.Controls/TopLevel.cs @@ -67,6 +67,11 @@ namespace Perspex.Controls /// private IAccessKeyHandler accessKeyHandler; + /// + /// The access keyboard navigation handler for the window. + /// + private IKeyboardNavigationHandler keyboardNavigationHandler; + /// /// Whether an auto-size operation is in progress. /// @@ -91,6 +96,7 @@ namespace Perspex.Controls this.PlatformImpl = impl; this.accessKeyHandler = Locator.Current.GetService(); this.inputManager = Locator.Current.GetService(); + this.keyboardNavigationHandler = Locator.Current.GetService(); this.LayoutManager = Locator.Current.GetService(); this.renderManager = Locator.Current.GetService(); @@ -129,6 +135,11 @@ namespace Perspex.Controls this.accessKeyHandler.SetOwner(this); } + if (this.keyboardNavigationHandler != null) + { + this.keyboardNavigationHandler.SetOwner(this); + } + this.PlatformImpl.SetOwner(this); this.PlatformImpl.Activated = this.HandleActivated; this.PlatformImpl.Deactivated = this.HandleDeactivated; @@ -227,6 +238,14 @@ namespace Perspex.Controls get { return this.accessKeyHandler; } } + /// + /// Gets or sets the keyboard navigation handler for the window. + /// + IKeyboardNavigationHandler IInputRoot.KeyboardNavigationHandler + { + get { return this.keyboardNavigationHandler; } + } + /// /// Gets or sets a value indicating whether access keys are shown in the window. /// diff --git a/Perspex.Input/AccessKeyHandler.cs b/Perspex.Input/AccessKeyHandler.cs index 42747692bd..6697f3a101 100644 --- a/Perspex.Input/AccessKeyHandler.cs +++ b/Perspex.Input/AccessKeyHandler.cs @@ -4,11 +4,11 @@ // // ----------------------------------------------------------------------- -using Perspex.Interactivity; -using System; - namespace Perspex.Input { + using System; + using Perspex.Interactivity; + /// /// Handles access keys for a window. /// @@ -38,6 +38,8 @@ namespace Perspex.Input /// public void SetOwner(IInputRoot owner) { + Contract.Requires(owner != null); + if (this.owner != null) { throw new InvalidOperationException("AccessKeyHandler owner has already been set."); diff --git a/Perspex.Input/IInputRoot.cs b/Perspex.Input/IInputRoot.cs index 45f7586bbf..03f9ab3502 100644 --- a/Perspex.Input/IInputRoot.cs +++ b/Perspex.Input/IInputRoot.cs @@ -16,6 +16,11 @@ namespace Perspex.Input /// IAccessKeyHandler AccessKeyHandler { get; } + /// + /// Gets or sets the keyboard navigation handler. + /// + IKeyboardNavigationHandler KeyboardNavigationHandler { get; } + /// /// Gets or sets a value indicating whether access keys are shown in the window. /// diff --git a/Perspex.Input/IKeyboardNavigation.cs b/Perspex.Input/IKeyboardNavigation.cs deleted file mode 100644 index c51c1d8177..0000000000 --- a/Perspex.Input/IKeyboardNavigation.cs +++ /dev/null @@ -1,21 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright 2014 MIT Licence. See licence.md for more information. -// -// ----------------------------------------------------------------------- - -namespace Perspex.Input -{ - public interface IKeyboardNavigation - { - IInputElement GetNextInTabOrder(IInputElement element); - - IInputElement GetPreviousInTabOrder(IInputElement element); - - void TabNext(IInputElement element); - - void TabPrevious(IInputElement element); - - void TabTo(IInputElement element); - } -} \ No newline at end of file diff --git a/Perspex.Input/IKeyboardNavigationHandler.cs b/Perspex.Input/IKeyboardNavigationHandler.cs new file mode 100644 index 0000000000..37781e1cd0 --- /dev/null +++ b/Perspex.Input/IKeyboardNavigationHandler.cs @@ -0,0 +1,35 @@ +// ----------------------------------------------------------------------- +// +// Copyright 2015 MIT Licence. See licence.md for more information. +// +// ----------------------------------------------------------------------- + +namespace Perspex.Input +{ + /// + /// Defines the interface for classes that handle keyboard navigation for a window. + /// + public interface IKeyboardNavigationHandler + { + /// + /// Sets the owner of the keyboard navigation handler. + /// + /// The owner. + /// + /// This method can only be called once, typically by the owner itself on creation. + /// + void SetOwner(IInputRoot owner); + + /// + /// Moves the focus to the next control in tab order. + /// + /// The current element. + void TabNext(IInputElement element); + + /// + /// Moves the focus to the previous control in tab order. + /// + /// The current element. + void TabPrevious(IInputElement element); + } +} \ No newline at end of file diff --git a/Perspex.Input/InputElement.cs b/Perspex.Input/InputElement.cs index c52addf8b2..f39b3d40b6 100644 --- a/Perspex.Input/InputElement.cs +++ b/Perspex.Input/InputElement.cs @@ -238,21 +238,6 @@ namespace Perspex.Input protected virtual void OnKeyDown(KeyEventArgs e) { - if (e.Key == Key.Tab && !e.Handled) - { - var shift = (e.Device.Modifiers & ModifierKeys.Shift) != 0; - - if (!shift) - { - KeyboardNavigation.Instance.TabNext(this); - } - else - { - KeyboardNavigation.Instance.TabPrevious(this); - } - - e.Handled = true; - } } protected virtual void OnKeyUp(KeyEventArgs e) diff --git a/Perspex.Input/KeyboardNavigation.cs b/Perspex.Input/KeyboardNavigation.cs index e9b015b5c3..23297ca24b 100644 --- a/Perspex.Input/KeyboardNavigation.cs +++ b/Perspex.Input/KeyboardNavigation.cs @@ -6,289 +6,70 @@ namespace Perspex.Input { - using System; - using System.Collections.Generic; - using System.Linq; - using Perspex.VisualTree; - using Splat; - - public class KeyboardNavigation : IKeyboardNavigation + /// + /// Defines attached properties that control keyboard navigation behaviour for a container. + /// + public static class KeyboardNavigation { + /// + /// Defines the TabNavigation attached property. + /// + /// + /// The TabNavigation attached property defines how pressing the Tab key causes focus to + /// be navigated between the children of the container. + /// public static readonly PerspexProperty TabNavigationProperty = - PerspexProperty.RegisterAttached("TabNavigation"); - + PerspexProperty.RegisterAttached("TabNavigation", typeof(KeyboardNavigation)); + + /// + /// Defines the TabOnceActiveElement attached property. + /// + /// + /// When focus enters a container which has its + /// attached property set to , this property + /// defines to which child the focus should move. + /// public static readonly PerspexProperty TabOnceActiveElementProperty = - PerspexProperty.RegisterAttached("TabOnceActiveElement"); - - public static IKeyboardNavigation Instance - { - get { return Locator.Current.GetService(); } - } + PerspexProperty.RegisterAttached("TabOnceActiveElement", typeof(KeyboardNavigation)); + /// + /// Gets the for a container. + /// + /// The container. + /// The for the container. public static KeyboardNavigationMode GetTabNavigation(InputElement element) { return element.GetValue(TabNavigationProperty); } + /// + /// Sets the for a container. + /// + /// The container. + /// The for the container. public static void SetTabNavigation(InputElement element, KeyboardNavigationMode value) { element.SetValue(TabNavigationProperty, value); } + /// + /// Gets the for a container. + /// + /// The container. + /// The active element for the container. public static IInputElement GetTabOnceActiveElement(InputElement element) { return element.GetValue(TabOnceActiveElementProperty); } + /// + /// Sets the for a container. + /// + /// The container. + /// The active element for the container. public static void SetTabOnceActiveElement(InputElement element, IInputElement value) { element.SetValue(TabOnceActiveElementProperty, value); } - - public IInputElement GetNextInTabOrder(IInputElement element) - { - Contract.Requires(element != null); - - var container = element.GetVisualParent(); - - if (container != null) - { - var mode = GetTabNavigation((InputElement)container); - - switch (mode) - { - case KeyboardNavigationMode.Continue: - return GetNextInContainer(element, container) ?? - GetFirstInNextContainer(container); - case KeyboardNavigationMode.Cycle: - return GetNextInContainer(element, container) ?? - GetDescendents(container).FirstOrDefault(); - default: - return GetFirstInNextContainer(container); - } - } - else - { - return GetDescendents(element).FirstOrDefault(); - } - } - - public IInputElement GetPreviousInTabOrder(IInputElement element) - { - Contract.Requires(element != null); - - var container = element.GetVisualParent(); - - if (container != null) - { - var mode = GetTabNavigation((InputElement)container); - - switch (mode) - { - case KeyboardNavigationMode.Continue: - return GetPreviousInContainer(element, container) ?? - GetLastInPreviousContainer(element); - case KeyboardNavigationMode.Cycle: - return GetPreviousInContainer(element, container) ?? - GetDescendents(container).LastOrDefault(); - default: - return GetLastInPreviousContainer(container); - } - } - else - { - return GetDescendents(element).LastOrDefault(); - } - } - - public void TabNext(IInputElement element) - { - Contract.Requires(element != null); - - var next = GetNextInTabOrder(element); - - if (next != null) - { - TabTo(next); - } - } - - public void TabPrevious(IInputElement element) - { - Contract.Requires(element != null); - - var next = GetPreviousInTabOrder(element); - - if (next != null) - { - TabTo(next); - } - } - - public void TabTo(IInputElement element) - { - Contract.Requires(element != null); - - FocusManager.Instance.Focus(element, true); - } - - private static bool CanFocus(IInputElement e) => e.Focusable && e.IsEnabledCore && e.IsVisible; - - private static bool CanFocusDescendent(IInputElement e) => e.IsEnabledCore && e.IsVisible; - - private static IEnumerable GetDescendents(IInputElement element) - { - var mode = GetTabNavigation((InputElement)element); - - if (mode == KeyboardNavigationMode.Never) - { - yield break; - } - - var children = element.GetVisualChildren().OfType(); - - if (mode == KeyboardNavigationMode.Once) - { - var active = GetTabOnceActiveElement((InputElement)element); - - if (active != null) - { - yield return active; - yield break; - } - else - { - children = children.Take(1); - } - } - - foreach (var child in children) - { - if (CanFocus(child)) - { - yield return child; - } - - if (CanFocusDescendent(child)) - { - foreach (var descendent in GetDescendents(child)) - { - yield return descendent; - } - } - } - } - - private static IInputElement GetNextInContainer(IInputElement element, IInputElement container) - { - var descendent = GetDescendents(element).FirstOrDefault(); - - if (descendent != null) - { - return descendent; - } - else if (container != null) - { - var sibling = container.GetVisualChildren() - .OfType() - .Where(CanFocus) - .SkipWhile(x => x != element) - .Skip(1) - .FirstOrDefault(); - - if (sibling != null) - { - return sibling; - } - } - - return null; - } - - private static IInputElement GetPreviousInContainer(IInputElement element, IInputElement container) - { - return container.GetVisualChildren() - .OfType() - .Where(CanFocus) - .TakeWhile(x => x != element) - .LastOrDefault(); - } - - private static IInputElement GetFirstInNextContainer(IInputElement container) - { - var parent = container.GetVisualParent(); - IInputElement next = null; - - if (parent != null) - { - var sibling = parent.GetVisualChildren() - .OfType() - .Where(CanFocusDescendent) - .SkipWhile(x => x != container) - .Skip(1) - .FirstOrDefault(); - - if (sibling != null) - { - if (CanFocus(sibling)) - { - next = sibling; - } - else - { - next = GetDescendents(sibling).FirstOrDefault(); - } - } - - if (next == null) - { - next = GetFirstInNextContainer(parent); - } - } - else - { - next = GetDescendents(container).FirstOrDefault(); - } - - return next; - } - - private static IInputElement GetLastInPreviousContainer(IInputElement container) - { - var parent = container.GetVisualParent(); - IInputElement next = null; - - if (parent != null) - { - var sibling = parent.GetVisualChildren() - .OfType() - .Where(CanFocusDescendent) - .TakeWhile(x => x != container) - .LastOrDefault(); - - if (sibling != null) - { - if (CanFocus(sibling)) - { - next = sibling; - } - else - { - next = GetDescendents(sibling).LastOrDefault(); - } - } - - if (next == null) - { - next = GetLastInPreviousContainer(parent); - } - } - else - { - next = GetDescendents(container).LastOrDefault(); - } - - return next; - } } } diff --git a/Perspex.Input/KeyboardNavigationHandler.cs b/Perspex.Input/KeyboardNavigationHandler.cs new file mode 100644 index 0000000000..018027067c --- /dev/null +++ b/Perspex.Input/KeyboardNavigationHandler.cs @@ -0,0 +1,362 @@ +// ----------------------------------------------------------------------- +// +// Copyright 2015 MIT Licence. See licence.md for more information. +// +// ----------------------------------------------------------------------- + +namespace Perspex.Input +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Perspex.VisualTree; + + /// + /// Handles keyboard navigation for a window. + /// + public class KeyboardNavigationHandler : IKeyboardNavigationHandler + { + /// + /// The window to which the handler belongs. + /// + private IInputRoot owner; + + /// + /// Sets the owner of the keyboard navigation handler. + /// + /// The owner. + /// + /// This method can only be called once, typically by the owner itself on creation. + /// + public void SetOwner(IInputRoot owner) + { + Contract.Requires(owner != null); + + if (this.owner != null) + { + throw new InvalidOperationException("AccessKeyHandler owner has already been set."); + } + + this.owner = owner; + + this.owner.AddHandler(InputElement.KeyDownEvent, this.OnKeyDown); + } + + /// + /// Gets the next element in tab order. + /// + /// The element. + /// The next element in tab order. + public static IInputElement GetNextInTabOrder(IInputElement element) + { + Contract.Requires(element != null); + + var container = element.GetVisualParent(); + + if (container != null) + { + var mode = KeyboardNavigation.GetTabNavigation((InputElement)container); + + switch (mode) + { + case KeyboardNavigationMode.Continue: + return GetNextInContainer(element, container) ?? + GetFirstInNextContainer(container); + case KeyboardNavigationMode.Cycle: + return GetNextInContainer(element, container) ?? + GetDescendents(container).FirstOrDefault(); + default: + return GetFirstInNextContainer(container); + } + } + else + { + return GetDescendents(element).FirstOrDefault(); + } + } + + /// + /// Gets the next element in tab order. + /// + /// The element. + /// The next element in tab order. + public static IInputElement GetPreviousInTabOrder(IInputElement element) + { + Contract.Requires(element != null); + + var container = element.GetVisualParent(); + + if (container != null) + { + var mode = KeyboardNavigation.GetTabNavigation((InputElement)container); + + switch (mode) + { + case KeyboardNavigationMode.Continue: + return GetPreviousInContainer(element, container) ?? + GetLastInPreviousContainer(element); + case KeyboardNavigationMode.Cycle: + return GetPreviousInContainer(element, container) ?? + GetDescendents(container).LastOrDefault(); + default: + return GetLastInPreviousContainer(container); + } + } + else + { + return GetDescendents(element).LastOrDefault(); + } + } + + /// + /// Moves the focus to the next control in tab order. + /// + /// The current element. + public void TabNext(IInputElement element) + { + Contract.Requires(element != null); + + var next = GetNextInTabOrder(element); + + if (next != null) + { + FocusManager.Instance.Focus(next, true); + } + } + + /// + /// Moves the focus to the previous control in tab order. + /// + /// The current element. + public void TabPrevious(IInputElement element) + { + Contract.Requires(element != null); + + var next = GetPreviousInTabOrder(element); + + if (next != null) + { + FocusManager.Instance.Focus(next, true); + } + } + + /// + /// Checks if the specified element can be focused. + /// + /// The element. + /// True if the element can be focused. + private static bool CanFocus(IInputElement e) => e.Focusable && e.IsEnabledCore && e.IsVisible; + + /// + /// Checks if a descendent of the specified element can be focused. + /// + /// The element. + /// True if a descendent of the element can be focused. + private static bool CanFocusDescendent(IInputElement e) => e.IsEnabledCore && e.IsVisible; + + /// + /// Gets the focusable descendents of the specified element, depending on the element's + /// . + /// + /// The element. + /// The element's focusable descendents. + private static IEnumerable GetDescendents(IInputElement element) + { + var mode = KeyboardNavigation.GetTabNavigation((InputElement)element); + + if (mode == KeyboardNavigationMode.Never) + { + yield break; + } + + var children = element.GetVisualChildren().OfType(); + + if (mode == KeyboardNavigationMode.Once) + { + var active = KeyboardNavigation.GetTabOnceActiveElement((InputElement)element); + + if (active != null) + { + yield return active; + yield break; + } + else + { + children = children.Take(1); + } + } + + foreach (var child in children) + { + if (CanFocus(child)) + { + yield return child; + } + + if (CanFocusDescendent(child)) + { + foreach (var descendent in GetDescendents(child)) + { + yield return descendent; + } + } + } + } + + /// + /// Gets the next item that should be focused in the specified container. + /// + /// The starting element/ + /// The container. + /// The next element, or null if the element is the last. + private static IInputElement GetNextInContainer(IInputElement element, IInputElement container) + { + var descendent = GetDescendents(element).FirstOrDefault(); + + if (descendent != null) + { + return descendent; + } + else if (container != null) + { + var sibling = container.GetVisualChildren() + .OfType() + .Where(CanFocus) + .SkipWhile(x => x != element) + .Skip(1) + .FirstOrDefault(); + + if (sibling != null) + { + return sibling; + } + } + + return null; + } + + /// + /// Gets the previous item that should be focused in the specified container. + /// + /// The starting element/ + /// The container. + /// The previous element, or null if the element is the first. + private static IInputElement GetPreviousInContainer(IInputElement element, IInputElement container) + { + return container.GetVisualChildren() + .OfType() + .Where(CanFocus) + .TakeWhile(x => x != element) + .LastOrDefault(); + } + + /// + /// Gets the first item that should be focused in the next container. + /// + /// The container. + /// The first element, or null if there are no more elements. + private static IInputElement GetFirstInNextContainer(IInputElement container) + { + var parent = container.GetVisualParent(); + IInputElement next = null; + + if (parent != null) + { + var sibling = parent.GetVisualChildren() + .OfType() + .Where(CanFocusDescendent) + .SkipWhile(x => x != container) + .Skip(1) + .FirstOrDefault(); + + if (sibling != null) + { + if (CanFocus(sibling)) + { + next = sibling; + } + else + { + next = GetDescendents(sibling).FirstOrDefault(); + } + } + + if (next == null) + { + next = GetFirstInNextContainer(parent); + } + } + else + { + next = GetDescendents(container).FirstOrDefault(); + } + + return next; + } + + /// + /// Gets the last item that should be focused in the previous container. + /// + /// The container. + /// The next element, or null if there are no more elements. + private static IInputElement GetLastInPreviousContainer(IInputElement container) + { + var parent = container.GetVisualParent(); + IInputElement next = null; + + if (parent != null) + { + var sibling = parent.GetVisualChildren() + .OfType() + .Where(CanFocusDescendent) + .TakeWhile(x => x != container) + .LastOrDefault(); + + if (sibling != null) + { + if (CanFocus(sibling)) + { + next = sibling; + } + else + { + next = GetDescendents(sibling).LastOrDefault(); + } + } + + if (next == null) + { + next = GetLastInPreviousContainer(parent); + } + } + else + { + next = GetDescendents(container).LastOrDefault(); + } + + return next; + } + + /// + /// Handles the Tab key being pressed in the window. + /// + /// The event sender. + /// The event args. + protected virtual void OnKeyDown(object sender, KeyEventArgs e) + { + var current = FocusManager.Instance.Current; + + if (e.Key == Key.Tab && current != null) + { + if ((KeyboardDevice.Instance.Modifiers & ModifierKeys.Shift) == 0) + { + this.TabNext(current); + } + else + { + this.TabPrevious(current); + } + } + } + } +} diff --git a/Perspex.Input/Perspex.Input.csproj b/Perspex.Input/Perspex.Input.csproj index 259e7afd11..e62373cb93 100644 --- a/Perspex.Input/Perspex.Input.csproj +++ b/Perspex.Input/Perspex.Input.csproj @@ -73,7 +73,7 @@ - + @@ -82,6 +82,7 @@ + diff --git a/Tests/Perspex.Input.UnitTests/KeyboardNavigationTests.cs b/Tests/Perspex.Input.UnitTests/KeyboardNavigationTests.cs index 292ff1fcf8..71e4bca1ac 100644 --- a/Tests/Perspex.Input.UnitTests/KeyboardNavigationTests.cs +++ b/Tests/Perspex.Input.UnitTests/KeyboardNavigationTests.cs @@ -43,7 +43,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -81,7 +81,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -111,7 +111,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -155,7 +155,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -174,7 +174,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(top); Assert.Equal(next, result); @@ -218,7 +218,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -257,7 +257,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -296,7 +296,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -335,7 +335,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -376,7 +376,7 @@ namespace Perspex.Input.UnitTests KeyboardNavigation.SetTabOnceActiveElement(container, next); - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -415,7 +415,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -456,7 +456,7 @@ namespace Perspex.Input.UnitTests KeyboardNavigation.SetTabOnceActiveElement(container, next); - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetNextInTabOrder(current); Assert.Equal(next, result); @@ -494,7 +494,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -532,7 +532,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -562,7 +562,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -606,7 +606,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -650,7 +650,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -689,7 +689,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -728,7 +728,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -767,7 +767,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -808,7 +808,7 @@ namespace Perspex.Input.UnitTests KeyboardNavigation.SetTabOnceActiveElement(container, next); - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result); @@ -847,7 +847,7 @@ namespace Perspex.Input.UnitTests } }; - var target = new KeyboardNavigation(); + var target = new KeyboardNavigationHandler(); var result = target.GetPreviousInTabOrder(current); Assert.Equal(next, result);