qds-popover displays arbitrary nonmodal content beside an anchor. Its panel
uses the native Popover API in the top layer while retaining its shadow root.
It flips to an available side, clamps to the visual viewport, and follows
scrolling, resizing, and content-size changes.
<qds-popover label="Report actions" placement="bottom-start" autofocus>
<button type="button" slot="anchor">Actions</button>
<button type="button">Export report</button>
</qds-popover>
anchor property, identify one with for="id",
or use slot="anchor". Priority follows that order. Use a native button or
another accessible trigger; the popover does not invent keyboard behavior for a div.aria-expanded, aria-haspopup, and control association are
managed and its previous attributes restored on disconnection.open is the actual requested state; show(), hide(), and toggle() emit
cancelable open-change requests. Prevent a request to preserve current state.controlled, requests contain { open, reason } but do not mutate
open. The application must assign it. toggle reports actual visibility.open state, including controlled descendants, to avoid orphaned overlays.popover.addEventListener('open-change', event => {
if (event.target === popover) popover.open = event.detail.open;
});
placement accepts bottom, bottom-start (default), bottom-end, top,
top-start, top-end, left, and right. Start/end follow text direction.
offset is a nonnegative pixel gap, default 8. reposition() supports custom
layout work in addition to automatic observers.
Outside pointer interaction and Escape close by default. no-outside-dismiss
and no-escape opt out. Escape closes the deepest open overlay first and
returns focus to its anchor. autofocus moves focus to the first content control;
otherwise opening does not move focus. This is nonmodal: focus is not trapped.
When focus is inside content on closure, it returns to the previously focused
invoker; if opening started with only the document body focused (as with some
Safari pointer interactions), the anchor is the fallback. Explicit invokers keep
their focus-return behavior. Northwind’s document-library review instructions
use the generated popover wrapper and a Return to document action.
Use qds-dialog for a modal workflow and qds-tooltip for noninteractive help.
Nested popovers stay open while their children are used. Closing a parent closes
its descendants and cancels observers/listeners. Give each panel a meaningful
label; content keeps its native semantics. The panel part and existing
surface/border/text/shadow tokens support both themes. Optional
--qds-popover-padding and existing --qds-popover-z customize the surface.
The shared AnchoredOverlayController owns top-layer nesting, dismissal,
observers and positioning for public popovers/tooltips. It reuses the legacy
computePlacement flip calculation. Existing PopoverController remains the
compatible absolute-position, single-open contract for select/date-picker;
changing that contract would affect their form semantics and is intentionally
separate from adding this public arbitrary-content API. Neither path relocates
application content to the document body.
Coordination state is stored per document under a shared symbol so separately
loaded standalone bundles participate in the same nesting and dismissal order.
Switching the anchor property while open reconnects its observers.
See the demo for nested, controlled and collision-aware examples.