pub struct KeyEventRoute { /* private fields */ }Expand description
The focused component’s keyboard route within a receiving surface or modal.
Platform shells create one route per hardware event, dispatch preview, run
their existing focused-control/editor handling, then dispatch unconsumed
events in the bubble phase. The route follows live parent links and stops at
root; a focused node belonging to another window is excluded.
Implementations§
Source§impl KeyEventRoute
impl KeyEventRoute
Sourcepub fn new(applier: &mut MemoryApplier, root: Option<NodeId>) -> Self
pub fn new(applier: &mut MemoryApplier, root: Option<NodeId>) -> Self
Captures the ancestor route for the currently focused component.
Sourcepub fn contains_focus(applier: &mut MemoryApplier, root: Option<NodeId>) -> bool
pub fn contains_focus(applier: &mut MemoryApplier, root: Option<NodeId>) -> bool
Whether the focused component belongs to the receiving surface or modal.
Platform clipboard and IME entry points use this before accessing a focused editor. This check does not create a keyboard handler route.
Sourcepub fn focus_is_current(&self) -> bool
pub fn focus_is_current(&self) -> bool
Whether focused-control dispatch still belongs to this event’s target.
A preview callback can move or clear focus. The event must not then edit the newly focused field or activate a control on another surface.
Sourcepub fn dispatch_preview(
&self,
applier: &mut MemoryApplier,
event: &KeyEvent,
) -> bool
pub fn dispatch_preview( &self, applier: &mut MemoryApplier, event: &KeyEvent, ) -> bool
Offers the event to ancestors before the focused component.
Sourcepub fn dispatch_bubble(
&self,
applier: &mut MemoryApplier,
event: &KeyEvent,
) -> bool
pub fn dispatch_bubble( &self, applier: &mut MemoryApplier, event: &KeyEvent, ) -> bool
Offers an unconsumed event from the focused component to its ancestors.