Construct a new focus tracker.
A signal emitted when the active widget has changed.
The active widget in the tracker.
The active widget is the widget among the tracked widgets which has the descendant node which is currently focused.
A signal emitted when the current widget has changed.
The current widget in the tracker.
The current widget is the widget among the tracked widgets which has the descendant node which has most recently been focused.
The current widget will not be updated if the node loses focus. It will only be updated when a different tracked widget gains focus.
If the current widget is removed from the tracker, the previous current widget will be restored.
This behavior is intended to follow a user's conceptual model of a semantically "current" widget, where the "last thing of type X" to be interacted with is the "current instance of X", regardless of whether that instance still has focus.
A flag indicating whether the tracker is disposed.
A read only array of the widgets being tracked.
Handle the 'blur'
event for a tracked widget.
Handle the 'focus'
event for a tracked widget.
Handle the disposed
signal for a tracked widget.
Set the current and active widgets for the tracker.
Add a widget to the focus tracker.
The widget of interest.
A widget will be automatically removed from the tracker if it is disposed after being added.
If the widget is already tracked, this is a no-op.
Dispose of the resources held by the tracker.
Get the focus number for a particular widget in the tracker.
The widget of interest.
The focus number for the given widget, or -1
if the
widget has not had focus since being added to the tracker, or
is not contained by the tracker.
The focus number indicates the relative order in which the widgets have gained focus. A widget with a larger number has gained focus more recently than a widget with a smaller number.
The currentWidget
will always have the largest focus number.
All widgets start with a focus number of -1
, which indicates that
the widget has not been focused since being added to the tracker.
Handle the DOM events for the focus tracker.
The DOM event sent to the panel.
This method implements the DOM EventListener
interface and is
called in response to events on the tracked nodes. It should
not be called directly by user code.
Test whether the focus tracker contains a given widget.
The widget of interest.
true
if the widget is tracked, false
otherwise.
Remove a widget from the focus tracker.
If the widget is the currentWidget
, the previous current widget
will become the new currentWidget
.
A widget will be automatically removed from the tracker if it is disposed after being added.
If the widget is not tracked, this is a no-op.
Generated using TypeDoc
A class which tracks focus among a set of widgets. The namespace for the
FocusTracker
class statics.This class is useful when code needs to keep track of the most recently focused widget(s) among a set of related widgets.