Function dispatch_event_bubbling

Source
pub fn dispatch_event_bubbling<A: 'static>(
    tree: &ElementTree<A>,
    runtime: RuntimeHandle<A>,
    target: ElementId,
    event: &Event,
)
Expand description

Synchronously dispatches an event from a target through its ancestor chain.

The target is visited first. Each widget may stop propagation through its EventCtx; otherwise traversal follows retained parent links. Non-widget and unlaid-out elements receive no callback but do not stop traversal. The generated contexts contain no host event metadata.

ยงExamples

use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::RuntimeHandle, element::{ElementKind, ElementTree}, input::dispatch_event_bubbling};
let mut tree = ElementTree::<()>::new();
let root = tree.create_element(ElementKind::Empty, None, None);
let child = tree.create_element(ElementKind::Empty, None, Some(root));
dispatch_event_bubbling(&tree, RuntimeHandle::new(), child, &Event::Focus(FocusEvent::new(false)));