Skip to main content

Class: ToolboxNavigator

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:19

Navigator that handles keyboard navigation within a toolbox.

Extends​

Properties index​

PropertyDescription
rulesMap from classes to a corresponding ruleset to handle navigation from instances of that class.
navigationLoopsWhether or not navigation loops around when reaching the end.
toolbox-

Methods index​

MethodDescription
addNavigationPolicyAdds a navigation ruleset to this Navigator.
getFirstChildReturns the first child of the given object instance, if any.
getParentReturns the parent of the given object instance, if any.
getNextSiblingReturns the next sibling of the given object instance, if any.
getPreviousSiblingReturns the previous sibling of the given object instance, if any.
setNavigationLoopsSets whether or not navigation should loop around when reaching the end of the workspace.
getNavigationLoopsReturns whether or not navigation loops around when reaching the end of the workspace.
getNavigableItemsReturns the navigable top-level items of a tree, in navigation order.
getFirstNodeGet the first navigable node on the workspace, or null if none exist.
getLastNodeGet the last navigable node on the workspace, or null if none exist.
transitionAllowedDetermines whether navigation is allowed between two nodes.
isNavigableReturns whether or not the given node is navigable.
getSourceBlockFromNodeReturns the block that the given node is a child of.
getInNodeReturns the flyout's first item (if any) or next toolbox item when navigating in (right arrow) from a toolbox.
getOutNodeReturns the flyout's first item (if any) or previous toolbox item when navigating out (left arrow) from a toolbox.
getNextNodeReturns the flyout's first item (if any) or next toolbox item when navigating next (down arrow) from a toolbox.
getPreviousNodeReturns the flyout's first item (if any) or previous toolbox item when navigating previous (up arrow) from a toolbox.
getTopLevelItemsReturns a list of all toolbox items.

Constructors​

Constructor​

new ToolboxNavigator(toolbox): ToolboxNavigator;

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:20

Parameters​

ParameterType
toolboxIToolbox

Returns​

ToolboxNavigator

Overrides​

Navigator.constructor

Properties​

rules​

protected rules: RuleList<any>;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:46

Map from classes to a corresponding ruleset to handle navigation from instances of that class.

Inherited from​

Navigator.rules


protected navigationLoops: boolean = true;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:59

Whether or not navigation loops around when reaching the end.

Inherited from​

Navigator.navigationLoops


toolbox​

protected toolbox: IToolbox;

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:20

Methods​

addNavigationPolicy()​

addNavigationPolicy(policy): void;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:67

Adds a navigation ruleset to this Navigator.

Parameters​

ParameterTypeDescription
policyINavigationPolicy<any>A ruleset that determines where focus should move starting from an instance of its managed class.

Returns​

void

Inherited from​

Navigator.addNavigationPolicy


getFirstChild()​

getFirstChild(current): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:91

Returns the first child of the given object instance, if any.

Parameters​

ParameterTypeDescription
currentIFocusableNodeThe object to retrieve the first child of.

Returns​

IFocusableNode | null

The first child node of the given object, if any.

Inherited from​

Navigator.getFirstChild


getParent()​

getParent(current): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:106

Returns the parent of the given object instance, if any.

Parameters​

ParameterTypeDescription
currentIFocusableNodeThe object to retrieve the parent of.

Returns​

IFocusableNode | null

The parent node of the given object, if any.

Inherited from​

Navigator.getParent


getNextSibling()​

getNextSibling(current): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:119

Returns the next sibling of the given object instance, if any.

Parameters​

ParameterTypeDescription
currentIFocusableNodeThe object to retrieve the next sibling node of.

Returns​

IFocusableNode | null

The next sibling node of the given object, if any.

Inherited from​

Navigator.getNextSibling


getPreviousSibling()​

getPreviousSibling(current): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:134

Returns the previous sibling of the given object instance, if any.

Parameters​

ParameterTypeDescription
currentIFocusableNodeThe object to retrieve the previous sibling node of.

Returns​

IFocusableNode | null

The previous sibling node of the given object, if any.

Inherited from​

Navigator.getPreviousSibling


setNavigationLoops()​

setNavigationLoops(loops): void;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:327

Sets whether or not navigation should loop around when reaching the end of the workspace.

Parameters​

ParameterTypeDescription
loopsbooleanTrue if navigation should loop around, otherwise false.

Returns​

void

Inherited from​

Navigator.setNavigationLoops


getNavigationLoops()​

getNavigationLoops(): boolean;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:335

Returns whether or not navigation loops around when reaching the end of the workspace.

Returns​

boolean

Inherited from​

Navigator.getNavigationLoops


getNavigableItems()​

getNavigableItems(root?): IFocusableNode[];

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:350

Returns the navigable top-level items of a tree, in navigation order.

For a workspace these are its stacks and comments; for a toolbox its categories; for a flyout its blocks, buttons and labels.

Parameters​

ParameterTypeDescription
rootIFocusableNode | undefinedThe root node of the tree to list, defaulting to the root of the currently focused tree.

Returns​

IFocusableNode[]

The navigable top-level items, or an empty list if there is no tree to list.

Inherited from​

Navigator.getNavigableItems


getFirstNode()​

getFirstNode(): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:363

Get the first navigable node on the workspace, or null if none exist.

Returns​

IFocusableNode | null

The first navigable node on the workspace, or null.

Inherited from​

Navigator.getFirstNode


getLastNode()​

getLastNode(): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:375

Get the last navigable node on the workspace, or null if none exist.

Returns​

IFocusableNode | null

The last navigable node on the workspace, or null.

Inherited from​

Navigator.getLastNode


transitionAllowed()​

protected transitionAllowed(
current,
candidate,
direction
): boolean;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:391

Determines whether navigation is allowed between two nodes.

Parameters​

ParameterTypeDescription
currentIFocusableNodeThe starting node for proposed navigation.
candidateIFocusableNodeThe proposed destination node.
directionNavigationDirectionThe direction in which the user is navigating.

Returns​

boolean

True if navigation should be allowed to proceed, or false to find a different candidate.

Inherited from​

Navigator.transitionAllowed


isNavigable()​

protected isNavigable(node): boolean | undefined;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:504

Returns whether or not the given node is navigable.

Parameters​

ParameterTypeDescription
nodeIFocusableNodeA focusable node to check the navigability of.

Returns​

boolean | undefined

True if the node is navigable, otherwise false.

Inherited from​

Navigator.isNavigable


getSourceBlockFromNode()​

getSourceBlockFromNode(node): BlockSvg | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/navigator.ts:513

Returns the block that the given node is a child of.

Parameters​

ParameterType
nodeIFocusableNode | null

Returns​

BlockSvg | null

The parent block of the node if any, otherwise null.

Inherited from​

Navigator.getSourceBlockFromNode


getInNode()​

getInNode(node?, bypassAdjustments?): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:33

Returns the flyout's first item (if any) or next toolbox item when navigating in (right arrow) from a toolbox.

Parameters​

ParameterTypeDefault valueDescription
nodeIFocusableNode | null...The toolbox item to navigate relative to.
bypassAdjustmentsbooleanfalseTrue to skip adjusting navigation based on the toolbox's layout; false (default) to take it into account.

Returns​

IFocusableNode | null

Overrides​

Navigator.getInNode


getOutNode()​

getOutNode(node?, bypassAdjustments?): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:75

Returns the flyout's first item (if any) or previous toolbox item when navigating out (left arrow) from a toolbox.

Parameters​

ParameterTypeDefault valueDescription
node?IFocusableNode | nullundefinedThe toolbox item to navigate relative to.
bypassAdjustments?booleanfalseTrue to skip adjusting navigation based on the toolbox's layout; false (default) to take it into account.

Returns​

IFocusableNode | null

Overrides​

Navigator.getOutNode


getNextNode()​

getNextNode(node?, bypassAdjustments?): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:101

Returns the flyout's first item (if any) or next toolbox item when navigating next (down arrow) from a toolbox.

Parameters​

ParameterTypeDefault valueDescription
node?IFocusableNode | nullundefinedThe toolbox item to navigate relative to.
bypassAdjustments?booleanfalseTrue to skip adjusting navigation based on the toolbox's layout; false (default) to take it into account.

Returns​

IFocusableNode | null

Overrides​

Navigator.getNextNode


getPreviousNode()​

getPreviousNode(node?, bypassAdjustments?): IFocusableNode | null;

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:126

Returns the flyout's first item (if any) or previous toolbox item when navigating previous (up arrow) from a toolbox.

Parameters​

ParameterTypeDefault valueDescription
node?IFocusableNode | nullundefinedThe toolbox item to navigate relative to.
bypassAdjustments?booleanfalseTrue to skip adjusting navigation based on the toolbox's layout; false (default) to take it into account.

Returns​

IFocusableNode | null

Overrides​

Navigator.getPreviousNode


getTopLevelItems()​

protected getTopLevelItems(): IFocusableNode[];

Defined in: packages/blockly/core/keyboard_nav/navigators/toolbox_navigator.ts:146

Returns a list of all toolbox items.

Returns​

IFocusableNode[]

Overrides​

Navigator.getTopLevelItems