pub fn ui_focus_system(
    state: Local<'_, State>,
    camera_query: Query<'_, '_, (Entity, &Camera)>,
    default_ui_camera: DefaultUiCamera<'_, '_>,
    primary_window: Query<'_, '_, Entity, With<PrimaryWindow>>,
    windows: Query<'_, '_, &Window>,
    mouse_button_input: Res<'_, ButtonInput<MouseButton>>,
    touches_input: Res<'_, Touches>,
    ui_scale: Res<'_, UiScale>,
    ui_stack: Res<'_, UiStack>,
    node_query: Query<'_, '_, NodeQuery>
)
Expand description

The system that sets Interaction for all UI elements based on the mouse cursor activity

Entities with a hidden ViewVisibility are always treated as released.