Expand description
Floating-panel behavior shared by <dropdown> and <menu>:
outside-click dismissal and viewport edge-flip anchoring.
The markup parser wraps each panel in an <if eq="true" mode="hide">
keyed on a synthetic open signal (__dropdown_open:* /
__menu_open:*) and tags the panel entity with PopupPanel. Two
tiny systems then act on any open panel:
dismiss_popups_on_outside_presscloses a panel when a primary press lands outside both the panel’s subtree and its trigger.flip_open_dropdown_panelspositions a dropdown panel just below its trigger, flipping above when the panel would overflow the viewport bottom - the same edge-flip rulecrate::tooltipapplies, factored intoanchored_popup_origin.
Structs§
- Popup
Gap - Gap between a popup panel and the control that opens it, in logical pixels. Sits on the trigger entity.
- Popup
Panel - Marker on a
<dropdown>/<menu>floating panel. Carries the open-state signal so the dismissal + edge-flip systems can query the panel by its bound signal.
Enums§
- Popup
Side - Which side of the anchor a popup prefers on its primary axis.
Functions§
- anchored_
popup_ origin - Viewport-space top-left for a
popup-sized box anchored to a trigger rect (anchor_pos/anchor_size), preferringsideand flipping to the opposite side of the viewport when the preferred placement would overflow.gappx separate the popup from the anchor on the primary axis; the cross axis aligns to the anchor’s leading edge and also flips inward when it would overflow. - dismiss_
popups_ on_ outside_ press - Close any open
PopupPanelwhen a primary press lands outside both the panel’s own subtree and (for dropdowns) its trigger header. - flip_
open_ dropdown_ panels - Anchor each open dropdown panel below its trigger header, flipping it above when the panel’s bottom edge would fall past the viewport bottom. Runs after the first layout pass has measured the panel (mirrors the tooltip’s spawn-then-measure ordering).