Collects the widgets Tab visits under root, in traversal order, into
out, and returns it.
The walk is collectPickables' walk, and prunes the same way: a subtree is
skipped entirely at any node that is visible = false or enabled = false,
so a hidden panel's buttons are not tabbable and a plain Group hides its UI
descendants too. A surviving widget joins the order when it is focusable,
enabled, not disabled, not disposed, and has not opted out with a negative
tabIndex.
The order, and where it departs from the DOM (decision, A-13)
Ascending accessibility.tabIndex (absent = 0), ties broken by scene
order — which is what the stability of Array.prototype.sort gives, at no
extra cost. Negative values are excluded from the traversal but stay
focusable programmatically.
The DOM instead visits positivetabindex values first, before everything
at 0, and every accessibility guide since has told authors never to use a
positive value because of it. That rule exists because HTML's tabindex must
interleave with an implicit document order the attribute cannot see. Here the
traversal order is the widget tree's own, the numbers are the only
ordering an author can state, and a plain ascending sort is what
tabIndex: 0, 1, 2 on three buttons plainly means. Stating the deviation is
cheaper than importing a rule whose own designers regret it.
Zero-alloc when out is supplied: it is overwritten, truncated, and sorted
in place.
Collects the widgets Tab visits under
root, in traversal order, intoout, and returns it.The walk is
collectPickables' walk, and prunes the same way: a subtree is skipped entirely at any node that isvisible = falseorenabled = false, so a hidden panel's buttons are not tabbable and a plainGrouphides its UI descendants too. A surviving widget joins the order when it is focusable, enabled, not disabled, not disposed, and has not opted out with a negativetabIndex.The order, and where it departs from the DOM (decision, A-13)
Ascending
accessibility.tabIndex(absent =0), ties broken by scene order — which is what the stability ofArray.prototype.sortgives, at no extra cost. Negative values are excluded from the traversal but stay focusable programmatically.The DOM instead visits positive
tabindexvalues first, before everything at0, and every accessibility guide since has told authors never to use a positive value because of it. That rule exists because HTML'stabindexmust interleave with an implicit document order the attribute cannot see. Here the traversal order is the widget tree's own, the numbers are the only ordering an author can state, and a plain ascending sort is whattabIndex: 0, 1, 2on three buttons plainly means. Stating the deviation is cheaper than importing a rule whose own designers regret it.Zero-alloc when
outis supplied: it is overwritten, truncated, and sorted in place.