Share via


WinJS.UI.XYFocus.findNextFocusElement function

Finds the next element that should receive focus in the specified direction. This function does not actually move the current focus.

Syntax

var htmlElement = WinJS.UI.XYFocus.findNextFocusElement(direction, options);

Parameters

  • direction
    Type: String

    The direction in which to move focus: "up", "left", "down", or "right".

  • options [optional]
    Type: Object

    An object that contains one or more property/value pairs to apply to the search. The following properties are supported:

Property Description

focusRoot

Type: HTMLElement

Specifies the root element of the search. By default, the document body is used as the search root.

referenceElement

Type: HTMLElement

Performs the search as though the specified element were the currently focused element, instead of using the actual currently focused element.

 

Return value

Type: HTMLElement

The element that should receive focus when the user navigates in the specified direction, or null if an element wasn't found.

Remarks

While using the same syntax as moveFocus(), the findNextFocusElement() function does not actually move the focus. But it can be used to identify the next element that will receive focus after a move in the specified direction. If the function returns null, there is not an available element to receive focus in the specified direction.

Requirements

Minimum WinJS version

WinJS 3.0

Namespace

WinJS.UI.XYFocus

See also

WinJS.UI.XYFocus

focusRoot