Internal_List of registered DOM elements.
Internal_List of views with external focus trackers that contribute to the state of this focus tracker.
ReadonlyfocusedThe currently focused element.
While #isFocused isFocused remains true, the focus can move between different UI elements. This property tracks those
elements and tells which one is currently focused.
Note: The values of this property are restricted to #elements or module:ui/view~View#element elements registered in #externalViews.
ReadonlyisTrue when one of the registered #elements or #externalViews is focused.
List of registered DOM elements.
Note: The list does do not include elements from #externalViews.
List of external focusable views that contribute to the state of this focus tracker. See #add to learn more.
Starts tracking a specified DOM element or a module:ui/view~View instance.
focus and blur events on this element.
Tracked elements are listed in #elements.FocusTracker instance (~ViewWithFocusTracker),
the external focus tracker's state (#isFocused, #focusedElement) starts contributing to the current tracker instance.
This allows for increasing the "reach" of a focus tracker instance, by connecting two or more focus trackers together when DOM
elements they track are located in different subtrees in DOM. External focus trackers are listed in #externalViews.FocusTracker (not a ~ViewWithFocusTracker),
its module:ui/view~View#element is used to track focus like any other DOM element.Destroys the focus tracker by:
Stops tracking focus in the specified DOM element or a module:ui/view~View view instance. See #add to learn more.
Allows observing a group of DOM
Elements or module:ui/view~View view instances whether at least one of them (or their child) is focused.Used by the module:core/editor/editor~Editor in order to track whether the focus is still within the application, or were used outside of its UI.
Note
focusandblurlisteners use event capturing, so it is only needed to register wrapperElementwhich contain otherfocusableelements. But note that this wrapper element has to be focusable too (have e.g.tabindex="-1").Check out the {@glink framework/deep-dive/ui/focus-tracking "Deep dive into focus tracking"} guide to learn more.