A modal panel at an edge of the screen that the user swipes away, with snap points and nested drawers, in each framework.
A panel that slides in from an edge of the screen: a bottom sheet, a side panel. It is a
Dialog: it takes focus, traps it, makes the rest of the page inert, closes on
Escape and on a press outside, and returns focus when it closes (the WAI-ARIA APG
modal dialog pattern). It adds a
swipe to dismiss with the mouse, a pen or a touch, snap points (a bottom sheet resting at
preset heights), the CSS variables your styles move it with, and nested drawers. The APG has no
drawer pattern: the gestures, the snap points and the names follow Base UI's Drawer.
Drawer has its own entry and is built on Dialog's parts, whose part attribute names the drawer
(drawer-popup), plus its own Content. The swipe is the toolkit's @fragiola/primitives/swipe
entry, which only Drawer imports: an app with Dialog alone never bundles it.
Open and close: as a Dialog's. Focus moves to the first tabbable element, Tab wraps inside,
Escape (escape-key), a press outside (outside-press), a Close part (close-press) or the
Trigger again (trigger-press) close it, focus returns to the trigger.
Swipe: a press on the Popup followed by a move of 6 px along the axis of swipeDirection
starts a swipe (data-swiping); a move along the other axis does nothing. Towards the edge the
popup follows the pointer; away from it, it moves less and less (damped). On release it
dismisses (reason swipe) when it moved more than half its size, or 10 px or more at a
flick's velocity (0.5 px per ms); otherwise it settles back.
Where a swipe starts: never on a text control, a range input or an element marked
data-swipe-ignore; with the mouse, never on a button, a link or a label, nor inside the
Content (where the mouse selects text). A touch swipes from anywhere else.
Scroll containment: a scrollable element under the pointer that can still scroll in the
direction of the move scrolls instead; the drawer moves once it reached its edge.
Snap points: with snapPoints, a bottom sheet rests at heights you give (fractions of the
viewport, px or rem); a release settles on the closest snap point to where it was let go (a
flick carries it further), or dismisses when closed is closer. onSnapPointChange reports the
new snap point with reason swipe.
Nested drawers: a Drawer inside a Drawer's popup is nested: data-nested on it,
data-nested-drawer-open and --nested-drawers on the parent; a swipe or Escape closes the
nested one alone (nested overlays).
Detached triggers and lifecycle: as a Dialog's, with a Drawer handle
(Drawer.createHandle()).
Every part also takes what the primitive contract gives. The
names below are React's; Vue binds them the same way (v-model:open, v-model:snap-point,
@open-change), and Angular as inputs and outputs ([(open)], [(snapPoint)],
(openChangeDetails)). A drawer is always modal.