Converse converse.js

Class: DOMNavigator

dom-navigator~DOMNavigator()

new DOMNavigator()

Adds the ability to navigate the DOM with the arrow keys

Source:

Classes

DIRECTION

Members

(static) DEFAULTS

The default options for the DOM navigator.

Source:

Methods

destroy()

Destroy this navigator removing any event registered and any other data.

Source:

disable()

Disable this navigator.

Source:

elementsAfter(left, top) → {Array}

Return an array of navigable elements after an offset.

Parameters:
Name Type Description
left number

The left offset.

top number

The top offset.

Source:
Returns:

An array of elements.

Type
Array

elementsBefore(left, top) → {Array}

Return an array of navigable elements before an offset.

Parameters:
Name Type Description
left number

The left offset.

top number

The top offset.

Source:
Returns:

An array of elements.

Type
Array

enable()

Enable this navigator.

Source:

getElements()

Find and store the navigable elements

Source:

getNextElement(direction) → {HTMLElement}

Parameters:
Name Type Description
direction 'down' | 'right' | 'left' | 'up'
Source:
Returns:
Type
HTMLElement

handleKeydown(event)

Handle the key down event.

Parameters:
Name Type Description
event Event

The event object.

Source:

inScrollContainerViewport(el) → {Boolean}

Indicate if an element is in the container viewport.

Parameters:
Name Type Description
el HTMLElement

The element to check.

Source:
Returns:

true if the given element is in the container viewport, otherwise false.

Type
Boolean

init()

Initialize the navigator.

Source:

scrollTo(el, direction)

Scroll the container to an element.

Parameters:
Name Type Description
el HTMLElement

The destination element.

direction String

The direction of the current navigation.

Source:
Returns:

void.

select(el, directionopt)

Select the given element.

Parameters:
Name Type Attributes Description
el Element

The DOM element to select.

direction string <optional>

The direction.

Source:

unselect()

Remove the current selection

Source:

dom-navigator~DOMNavigator(container, options)

new DOMNavigator(container, options)

Create a new DOM Navigator.

Parameters:
Name Type Description
container Element

The container of the element to navigate.

options Object

The options to configure the DOM navigator.

Properties
Name Type Attributes Default Description
getSelector function
down Number <optional>

The keycode for navigating down

left Number <optional>

The keycode for navigating left

right Number <optional>

The keycode for navigating right

up Number <optional>

The keycode for navigating up

selected String <optional>

The class that should be added to the currently selected DOM element.

jump_to_picked String <optional>

A selector, which if matched by the next element being navigated to, based on the direction given by jump_to_picked_direction, will cause navigation to jump to the element that matches the jump_to_picked_selector. For example, this is useful when navigating to tabs. You want to immediately navigate to the currently active tab instead of just navigating to the first tab.

jump_to_picked_selector String <optional>
picked

The selector indicating the currently picked element to jump to.

jump_to_picked_direction String <optional>

The direction for which jumping to the picked element should be enabled.

onSelected function <optional>

The callback function which should be called when en element gets selected.

Source:

Classes

DIRECTION

Members

(static) DEFAULTS

The default options for the DOM navigator.

Source:

Methods

destroy()

Destroy this navigator removing any event registered and any other data.

Source:

disable()

Disable this navigator.

Source:

elementsAfter(left, top) → {Array}

Return an array of navigable elements after an offset.

Parameters:
Name Type Description
left number

The left offset.

top number

The top offset.

Source:
Returns:

An array of elements.

Type
Array

elementsBefore(left, top) → {Array}

Return an array of navigable elements before an offset.

Parameters:
Name Type Description
left number

The left offset.

top number

The top offset.

Source:
Returns:

An array of elements.

Type
Array

enable()

Enable this navigator.

Source:

getElements()

Find and store the navigable elements

Source:

getNextElement(direction) → {HTMLElement}

Parameters:
Name Type Description
direction 'down' | 'right' | 'left' | 'up'
Source:
Returns:
Type
HTMLElement

handleKeydown(event)

Handle the key down event.

Parameters:
Name Type Description
event Event

The event object.

Source:

inScrollContainerViewport(el) → {Boolean}

Indicate if an element is in the container viewport.

Parameters:
Name Type Description
el HTMLElement

The element to check.

Source:
Returns:

true if the given element is in the container viewport, otherwise false.

Type
Boolean

init()

Initialize the navigator.

Source:

scrollTo(el, direction)

Scroll the container to an element.

Parameters:
Name Type Description
el HTMLElement

The destination element.

direction String

The direction of the current navigation.

Source:
Returns:

void.

select(el, directionopt)

Select the given element.

Parameters:
Name Type Attributes Description
el Element

The DOM element to select.

direction string <optional>

The direction.

Source:

unselect()

Remove the current selection

Source: