Non-modal floating content anchored to a trigger, following the APG's non-modal dialog disclosed by a button, in each framework.
A panel the user opens, uses and leaves, next to its trigger. The page stays usable while it is
open: focus is not trapped and nothing is inert. It is a non-modal dialog disclosed by a button
(WAI-ARIA APG dialog pattern, without
the modal parts). A menu of actions is a Menu; a description shown on hover is a
Tooltip.
Open: a press on the Trigger toggles it. Focus moves to initialFocus, else the first
tabbable element of the popup, else the popup itself (the APG dialog pattern).
Inside: in the tab order, the popup comes right after its trigger, even though it is
portalled. Tab from its last element moves on to the element after the trigger and closes it;
Shift+Tab from its first goes back to the trigger and closes it (reason focus-out).
Close: Escape (escape-key) or a Close part (close-press) or the Trigger again
(trigger-press) return focus to finalFocus, else the trigger. A press outside
(outside-press) returns it to the trigger unless the press landed on a focusable element,
which keeps the focus it got (Base UI's rule).
Layers: the popover is a layer of the nested overlay tree.
Opened inside a dialog, it is the dialog's child: it closes first on Escape and on a press
inside the dialog, and a menu opened from it is its own child. Closing it closes them.
Detached triggers: Triggers anywhere in the page open the same Root through a handle,
each with a payload (detached triggers). The popup anchors to
the active trigger and focus returns to it; a press on another trigger while open moves the
popover there, with that trigger's payload.
Positioning: side of the anchor, flipped to the other side when there is no room, shifted
along it to stay in the viewport, following scroll and resize. inline-start and inline-end
follow the direction; left and right do not. data-side says where it ended up.
Lifecycle: onOpenChange is called before the change (details.cancel() keeps it as it
is, change details), onOpenChangeComplete(open) reports
the end of each transition, the actions close() and unmount() act from code, and the
Portal's keepMounted keeps the Positioner in the page while closed (hidden, data-closed).
Every part also takes what the primitive contract gives:
render (Vue: as and the render slot), a class and a style, a ref, and any attribute, which
it forwards. The names below are React's; Vue binds them the same way (v-model:open,
@open-change, :side-offset), and Angular as inputs and outputs ([(open)],
(openChangeDetails), [sideOffset]).
every change, with its reason (trigger-press, close-press, escape-key, outside-press, focus-out); called before the change, details.cancel() stops it
onOpenChangeComplete
(open: boolean) => void
once an opening or a closing has finished its transitions (not on the first render, nor for an exit a reopening interrupted)
actionsRef (react)
{ current: OverlayActions | null }
receives close() (reason imperative-action) and unmount() (ends an exit now); Vue exposes them on the Root's template ref, Angular as the root directive's methods