Stay organized with collections
Save and categorize content based on your preferences.
blockly > FocusableTreeTraverser > findFocusableNodeFor
FocusableTreeTraverser.findFocusableNodeFor() method
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, 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.
Signature:
static findFocusableNodeFor(element: HTMLElement | SVGElement, tree: IFocusableTree): IFocusableNode | null;
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-24 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-24 UTC."],[],[],null,["[blockly](./blockly.md) \\\u003e [FocusableTreeTraverser](./blockly.focusabletreetraverser_class.md) \\\u003e [findFocusableNodeFor](./blockly.focusabletreetraverser_class.findfocusablenodefor_1_method.md)\n\nFocusableTreeTraverser.findFocusableNodeFor() method\n----------------------------------------------------\n\nReturns 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.\n\nIf the element exists within the specified tree's DOM structure but does not directly correspond to a node, the nearest parent node (or the tree's root) will be returned to represent the provided element.\n\nIf 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.\n\nThe provided element must have a non-null, non-empty ID that conforms to the contract mentioned in IFocusableNode.\n\n**Signature:** \n\n static findFocusableNodeFor(element: HTMLElement | SVGElement, tree: IFocusableTree): IFocusableNode | null;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|---------------------------------------------------------|----------------------------------------------------------------|\n| element | HTMLElement \\| SVGElement | The HTML or SVG element being sought. |\n| tree | [IFocusableTree](./blockly.ifocusabletree_interface.md) | The tree under which the provided element may be a descendant. |\n\n**Returns:**\n\n[IFocusableNode](./blockly.ifocusablenode_interface.md) \\| null\n\nThe matching IFocusableNode, or null if there is no match."]]