Skip to main content

Class: FlyoutNavigator

Defined in: packages/blockly/core/keyboard_nav/navigators/flyout_navigator.ts:18

Navigator that handles keyboard navigation within a flyout.

Extends

Properties index

PropertyDescription
flyout-
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.

Methods index

MethodDescription
getOutNodeReturns the parent toolbox item or previous flyout item when navigating out (left arrow) from a flyout.
getInNodeReturns the parent toolbox item or next flyout item when navigating in (right arrow) from a flyout.
getNextNodeReturns the parent toolbox item or next flyout item when navigating next (down arrow) from a flyout.
getPreviousNodeReturns the parent toolbox item or previous flyout item when navigating previous (up arrow) from a flyout.
getTopLevelItemsReturns a list of top-level navigable flyout items.
isNavigableReturns whether or not the given node is navigable.
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.
getSourceBlockFromNodeReturns the block that the given node is a child of.

Constructors

Constructor

new FlyoutNavigator(flyout): FlyoutNavigator;

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

Parameters

ParameterType
flyoutIFlyout

Returns

FlyoutNavigator

Overrides

Navigator.constructor

Properties

flyout

protected flyout: IFlyout;

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


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

Methods

getOutNode()

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

Defined in: packages/blockly/core/keyboard_nav/navigators/flyout_navigator.ts:35

Returns the parent toolbox item or previous flyout item when navigating out (left arrow) from a flyout.

Parameters

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

Returns

IFocusableNode | null

Overrides

Navigator.getOutNode


getInNode()

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

Defined in: packages/blockly/core/keyboard_nav/navigators/flyout_navigator.ts:66

Returns the parent toolbox item or next flyout item when navigating in (right arrow) from a flyout.

Parameters

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

Returns

IFocusableNode | null

Overrides

Navigator.getInNode


getNextNode()

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

Defined in: packages/blockly/core/keyboard_nav/navigators/flyout_navigator.ts:94

Returns the parent toolbox item or next flyout item when navigating next (down arrow) from a flyout.

Parameters

ParameterTypeDefault valueDescription
node?IFocusableNode | nullundefinedThe flyout item to navigate relative to.
bypassAdjustments?booleanfalseTrue to skip adjusting navigation based on the flyout'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/flyout_navigator.ts:119

Returns the parent toolbox item or previous flyout item when navigating previous (up arrow) from a flyout.

Parameters

ParameterTypeDefault valueDescription
node?IFocusableNode | nullundefinedThe flyout item to navigate relative to.
bypassAdjustments?booleanfalseTrue to skip adjusting navigation based on the flyout'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/flyout_navigator.ts:139

Returns a list of top-level navigable flyout items.

Returns

IFocusableNode[]

Overrides

Navigator.getTopLevelItems


isNavigable()

protected isNavigable(node): boolean | undefined;

Defined in: packages/blockly/core/keyboard_nav/navigators/flyout_navigator.ts:152

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.

Overrides

Navigator.isNavigable


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


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