pub fn eject_interaction_on_disable(
commands: Commands<'_, '_>,
newly_disabled: Query<'_, '_, Entity, Added<Disabled>>,
tracker: ResMut<'_, FocusTracker>,
tinted: Query<'_, '_, (&mut Visuals, &mut StyleOverrides)>,
focus_visibles: Query<'_, '_, (), With<FocusVisible>>,
focusables: Query<'_, '_, (Entity, &TabIndex, Option<&DocumentOrder>), Without<Disabled>>,
tab_info: Query<'_, '_, (&TabIndex, Option<&DocumentOrder>)>,
parents: Query<'_, '_, &ChildOf>,
visibles: Query<'_, '_, &Visible>,
styles: Query<'_, '_, &Style>,
)Expand description
The moment an entity gains Disabled (spec section 0: runtime
enable/disable via bind-disabled), strip every live interaction
state from it:
Hovered/Pressedare removed (with their transient tween components) - the hover tint / press tint end immediately, and a pending release will not click (dispatch_clicksrequiresPressed). The tinted fill is let go of at once, so the:disabledswap lands on the true idle style.- Keyboard focus moves to the next focusable in tab order (same
(TabIndex, DocumentOrder)orderingcycle_focus_on_tabuses, wrapping; hidden and disabled entities skipped), or clears when the disabled entity was the only focusable. TheFocusVisiblemarker travels with the focus if it was present.