Skip to main content

Module popup

Module popup 

Source
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:

Structs§

PopupGap
Gap between a popup panel and the control that opens it, in logical pixels. Sits on the trigger entity.
PopupPanel
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§

PopupSide
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), preferring side and flipping to the opposite side of the viewport when the preferred placement would overflow. gap px 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 PopupPanel when 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).