Skip to main content

dom

Function dom 

Source
pub fn dom<'a>(rect: Rect, sheet: &'a Sheet, root: El) -> DomBuilder<'a>
Expand description

Lay out root with sheet in rect (scrolled up by DomBuilder::scroll), paint it, and register every element with an id: buttons, switches, checkboxes and rows become focusable click targets named by their accessible name (El::name first, then text) with their checked state; DOM text inputs (uzor::ui::dom::Control::Input) become text-store fields, so caret, selection, drag, clipboard and IME work as in field. position: fixed elements (a select popover, a side panel) are placed against the panel and stay put while it scrolls.

Kit widgets go inside the tree through embed slots: call them at resp.dom.slots() after build.

Opt in with DomBuilder::dom_scroll to let elements with an id and overflow: auto | scroll scroll themselves, as in a browser: the wheel, a touchpad (1:1 with fling), a finger, keyboard steps queued with queue_scroll_key, a draggable thumb, nested chaining at the edges (overscroll-behavior: auto). Their offset lives in the widget state store under the id; read it from DomResponse::scrolls or dom_scroll_top, move it with dom_scroll_to. An element given a non-zero El::scroll_top by the app is the app’s to scroll, as is overflow: hidden. Off by default: an app that already scrolls those boxes itself (HQ’s @body) must not have them taken over.