core/tree

Implement an accessible aria tree widget, from a nested unordered list. Based on http://oaa-accessibility.org/example/41/.

Source:
License:
  • http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Methods

(inner) bindEventHandlers()

Source:

Bind the event listeners we require.

(inner) collapseGroup(item)

Source:

Collapse an expanded group.

Parameters:
Name Type Description
item Object

is the jquery id of the parent item of the group.

(inner) expandAllChildGroups(item)

Source:

Find all child group nodes from the given node and expand them.

Parameters:
Name Type Description
item Object

is the jquery id of the group.

(inner) expandAllGroups()

Source:

Expand all group nodes within the tree.

(inner) expandGroup(item) → {Object}

Source:

Expand a collapsed group.

Handles expanding nodes that are ajax loaded (marked with a data-requires-ajax attribute).

Parameters:
Name Type Description
item Object

is the jquery id of the parent item of the group.

Returns:

a promise that is resolved when the group has been expanded.

Type
Object

(inner) finishExpandingGroup(item)

Source:

Perform the necessary DOM changes to display a group item.

Parameters:
Name Type Description
item Object

is the jquery id of the parent item of the group.

(inner) getVisibleItems() → {Object}

Source:

Get all visible tree items.

Returns:

visible items

Type
Object

(inner) handleClick(event)

Source:

Handle a click (select).

Parameters:
Name Type Description
event Event

The event.

(inner) handleFocus(e)

Source:

Handle a focus event.

Parameters:
Name Type Description
e Event

The event.

(inner) handleKeyDown(e)

Source:

Handle a key down event - ie navigate the tree.

Parameters:
Name Type Description
e Event

The event.

(inner) initialiseNodes(node)

Source:

Performs the tree initialisation for all child items from the given node, such as removing everything from the tab order and setting aria selected on items.

Parameters:
Name Type Description
node object

jquery object representing a node.

(inner) isGroupCollapsed(item) → {bool}

Source:

Determines if the given group item (contains child tree items) is collapsed.

Parameters:
Name Type Description
item object

jquery object representing a group item on the tree.

Returns:
Type
bool

(inner) isGroupCollapsible(item) → {bool}

Source:

Determines if the given group item (contains child tree items) can be collapsed.

Parameters:
Name Type Description
item object

jquery object representing a group item on the tree.

Returns:
Type
bool

(inner) isGroupItem(item) → {bool}

Source:

Determines if the given item is a group item (contains child tree items) in the tree.

Parameters:
Name Type Description
item object

jquery object representing an item on the tree.

Returns:
Type
bool

(inner) isGroupItem(item) → {bool}

Source:

Determines if the given item is a group item (contains child tree items) in the tree.

Parameters:
Name Type Description
item object

jquery object representing an item on the tree.

Returns:
Type
bool

(inner) refreshVisibleItemsCache()

Source:

Find all visible tree items and save a cache of them on the tree object.

(inner) removeAllFromTabOrder(node)

Source:

Removes all child DOM elements of the given node from the tab order.

Parameters:
Name Type Description
node object

jquery object representing a node.

(inner) setActiveItem(item)

Source:

Mark the given item as active within the tree and fire the callback for when the active item is set.

Parameters:
Name Type Description
item object

jquery object representing an item on the tree.

(inner) setAriaSelectedFalseOnItems(node)

Source:

Find all child tree items from the given node and set the aria selected attribute to false.

Parameters:
Name Type Description
node object

jquery object representing a node.

(inner) toggleGroup(item)

Source:

Expand or collapse a group.

Parameters:
Name Type Description
item Object

is the jquery id of the parent item of the group.