The focus resolver to hand KeyboardInput for the tree rooted at root
(new KeyboardInput(window, { focusTarget: keyboardFocusTarget(uiRoot) })).
It answers the focused widget of root's tree, and root itself when
nothing is focused — which is the whole reason this helper exists rather
than () => focusedWidget(root). A key event with no target is not
dispatched at all, so the plain version would make the very first Tab
unreachable: nothing is focused, so nothing receives the keystroke that would
focus something. Falling back to the root means the traversal listener
installed there still hears it, and every later keystroke goes to the focused
widget and bubbles up through the root as usual.
The focus resolver to hand
KeyboardInputfor the tree rooted atroot(new KeyboardInput(window, { focusTarget: keyboardFocusTarget(uiRoot) })).It answers the focused widget of
root's tree, androotitself when nothing is focused — which is the whole reason this helper exists rather than() => focusedWidget(root). A key event with no target is not dispatched at all, so the plain version would make the very first Tab unreachable: nothing is focused, so nothing receives the keystroke that would focus something. Falling back to the root means the traversal listener installed there still hears it, and every later keystroke goes to the focused widget and bubbles up through the root as usual.