pub fn acquire_focus_tab_index(
acquire_focus: On<'_, '_, AcquireFocus>,
focusable: Query<'_, '_, (), (With<TabIndex>, Without<Window>)>,
focus: ResMut<'_, InputFocus>,
)Expand description
Observer which focuses the target of an AcquireFocus request when it has a TabIndex.
This is the tab-navigation-specific half of focus acquisition: only entities that opt into tab
navigation via TabIndex are treated as focus targets here. When the target is focusable, this
stops the request (so it never reaches the window) and focuses it; otherwise the request keeps
bubbling and is eventually handled by the generalized
on_window_acquire_focus_clear observer at the window.
The Without<Window> bound is a defensive guard — a window would never carry a TabIndex in
practice, but excluding it keeps this observer’s responsibility (focus a focusable child) cleanly
separate from the window-clearing fallback in on_window_acquire_focus_clear.
The focus.get() guard avoids spurious mutations so change detection only fires on real changes.