blockly > IFocusableNode > getFocusableElement
IFocusableNode.getFocusableElement() method
Returns the DOM element that can be explicitly requested to receive focus.
IMPORTANT: Please note that this element is expected to have a visual presence on the page as it will both be explicitly focused and have its style changed depending on its current focus state (i.e. blurred, actively focused, and passively focused). The element will have one of two styles attached (where no style indicates blurred/not focused): - blocklyActiveFocus - blocklyPassiveFocus
The returned element must also have a valid ID specified, and this ID should be unique across the entire page. Failing to have a properly unique ID could result in trying to focus one node (such as via a mouse click) leading to another node with the same ID actually becoming focused by FocusManager.
The returned element must be visible if the node is ever focused via FocusManager.focusNode() or FocusManager.focusTree(). It's allowed for an element to be hidden until onNodeFocus() is called, or become hidden with a call to onNodeBlur().
It's expected the actual returned element will not change for the lifetime of the node (that is, its properties can change but a new element should never be returned). Also, the returned element will have its tabindex overwritten throughout the lifecycle of this node and FocusManager.
If a node requires the ability to be focused directly without first being focused via FocusManager then it must set its own tab index.
Signature:
getFocusableElement(): HTMLElement | SVGElement;
Returns:
HTMLElement | SVGElement
The HTMLElement or SVGElement which can both receive focus and be visually represented as actively or passively focused for this node.