core/menu_navigation

Description:
  • Keyboard initialization for a given html node.

Source:
Author:
  • Mathew May <mathew.solutions>
License:
  • http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Keyboard initialization for a given html node.

Methods

(inner) clickErrorHandler(item, fallback) → {HTMLElement}

Description:
  • Small helper function to check if a given node is null or not.

Source:
Parameters:
Name Type Description
item HTMLElement | null

The node that we want to compare.

fallback HTMLElement

Either the first node or final node that can be focused on.

Returns:
Type
HTMLElement

(inner) clickListenerEvents(e)

Description:
  • Defined click event handling so we can remove listeners on nodes on resize etc.

Source:
Parameters:
Name Type Description
e event

The triggering element and key presses etc.

(inner) findUsableLastNode(elementRoot) → {HTMLElement}

Description:
  • We need to look within the menu to find a last node we can add focus to.

Source:
Parameters:
Name Type Description
elementRoot HTMLElement

Menu to find a final child node within.

Returns:
Type
HTMLElement

(inner) keyboardListenerEvents(e)

Description:
  • Defined keyboard event handling so we can remove listeners on nodes on resize etc.

Source:
Parameters:
Name Type Description
e event

The triggering element and key presses etc.

(inner) menuItemHelper(src)

Description:
  • Control classes etc of the selected dropdown item and its' parent

Source:
Parameters:
Name Type Description
src HTMLElement

The node within the dropdown the user selected.

(inner) setFocusHomeEnd(node)

Description:
  • Focus on either the start or end of a nav list.

Source:
Parameters:
Name Type Description
node HTMLElement

The element to focus on.

(inner) setFocusNext(currentNode, firstNode)

Description:
  • Handle the focusing to the next element in the dropdown.

Source:
Parameters:
Name Type Description
currentNode HTMLElement | null

The node that we want to take action on.

firstNode HTMLElement

The backup node to focus as a last resort.

(inner) setFocusPrev(currentNode, lastNode)

Description:
  • Handle the focusing to the previous element in the dropdown.

Source:
Parameters:
Name Type Description
currentNode HTMLElement | null

The node that we want to take action on.

lastNode HTMLElement

The backup node to focus as a last resort.