Class: FocusableTreeTraverser
Defined in: packages/blockly/core/utils/focusable_tree_traverser.ts:15
A helper utility for IFocusableTree implementations to aid with common tree traversals.
Methods index
| Method | Description |
|---|---|
| findFocusedNode | Returns the current IFocusableNode that is styled (and thus represented) as having either passive or active focus, only considering HTML and SVG elements. |
| findFocusableNodeFor | Returns the IFocusableNode corresponding to the specified HTML or SVG element iff it's the root element or a descendent of the root element of the specified IFocusableTree. |
Constructors
Constructor
new FocusableTreeTraverser(): FocusableTreeTraverser;
Returns
FocusableTreeTraverser
Methods
findFocusedNode()
static findFocusedNode(tree): IFocusableNode | null;
Defined in: packages/blockly/core/utils/focusable_tree_traverser.ts:34
Returns the current IFocusableNode that is styled (and thus represented) as having either passive or active focus, only considering HTML and SVG elements.
This can match against the tree's root.
Note that this will never return a node from a nested sub-tree as that tree should specifically be used to retrieve its focused node.
Parameters
| Parameter | Type | Description |
|---|---|---|
tree | IFocusableTree | The IFocusableTree in which to search for a focused node. |
Returns
IFocusableNode | null
The IFocusableNode currently with focus, or null if none.
findFocusableNodeFor()
static findFocusableNodeFor(element, tree): IFocusableNode | null;
Defined in: packages/blockly/core/utils/focusable_tree_traverser.ts:89
Returns the IFocusableNode corresponding to the specified HTML or SVG element iff it's the root element or a descendent of the root element of the specified IFocusableTree.
If the element exists within the specified tree's DOM structure but does not directly correspond to a node and is not a tab stop, the nearest parent node (or the tree's root) will be returned to represent the provided element.
If the tree contains another nested IFocusableTree, the nested tree may be traversed but its nodes will never be returned here per the contract of IFocusableTree.lookUpFocusableNode.
The provided element must have a non-null, non-empty ID that conforms to the contract mentioned in IFocusableNode.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | HTMLElement | SVGElement | The HTML or SVG element being sought. |
tree | IFocusableTree | The tree under which the provided element may be a descendant. |
Returns
IFocusableNode | null
The matching IFocusableNode, or null if there is no match.