blockly > IFocusableTree > getRestoredFocusableNode
IFocusableTree.getRestoredFocusableNode() method
Returns the IFocusableNode of this tree that should receive active focus when the tree itself has focus returned to it.
There are some very important notes to consider about a tree's focus lifecycle when implementing a version of this method that doesn't return null: 1. A null previousNode does not guarantee first-time focus state as nodes can be deleted. 2. This method is only used when the tree itself is focused, either through tab navigation or via FocusManager.focusTree(). In many cases, the previously focused node will be directly focused instead which will bypass this method. 3. The default behavior (i.e. returning null here) involves either restoring the previous node (previousNode) or focusing the tree's root. 4. The provided node may sometimes no longer be valid, such as in the case an attempt is made to focus a node that has been recently removed from its parent tree. Implementations can check for the validity of the node in order to specialize the node to which focus should fall back.
This method is largely intended to provide tree implementations with the means of specifying a better default node than their root.
Signature:
getRestoredFocusableNode(previousNode: IFocusableNode | null): IFocusableNode | null;
Parameters
Parameter | Type | Description |
---|---|---|
previousNode | IFocusableNode | null | The node that previously held passive focus for this tree, or null if the tree hasn't yet been focused. |
Returns:
IFocusableNode | null
The IFocusableNode that should now receive focus, or null if default behavior should be used, instead.