Skip to main content

Sheet

The map options surface: a bottom sheet with peek, half and full detents on narrow screens, and a floating side panel in the panel layout. Rendered by the app into MapChrome's sheet slot, outside the inert wrapper.

This is a function exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import { Sheet } from "@mapcairn/map";

function Sheet(input: SheetProps): JSX.Element;

Parameters​

  • { id, open, title, onClose, detent, onDetentChange, onModalChange, restoreFocus, testId, brand, children, }
  • input (SheetProps)

Returns​

JSX.Element

Remarks​

Sheet layout: a dialog labelled by its heading. It is non-modal at peek and half, so the map stays usable. At full it sets aria-modal, reports onModalChange(true) (the app makes the rest of the chrome inert) and loops Tab inside itself. Safari's default Tab skips links and buttons, so the keydown loop cannot see focus reach the last control there; at full the sheet also has an empty focus sentinel at each end, and the browser's own Tab landing on one sends focus round to the other end. The handle is a "Resize panel" button: Enter or Space cycles detents, the arrow keys step them, and the handle and header can be dragged, with rubber-banding past the ends and a velocity-aware snap on release. Detent changes are announced. The top edge and detent are published for the bottom slots, once per animation frame while dragging.

Panel layout: a complementary region labelled by its heading, never modal, with no handle. It publishes its right edge so bottom-start can move clear of it.

Both: focus moves to the heading on open; Escape and Close call onClose; restoreFocus runs after closing. One element serves both layouts (its role and data-layout change) so content stays mounted across a rotation. The detent heights take no bottom safe-area inset; the content pads for it.

See also​

Source: packages/map/src/chrome/Sheet/Sheet.tsx:234