How it works
The sheet is a fixed-position panel moved only with transform: translateY, which keeps dragging on the GPU compositor even on high refresh screens. During a drag, a pointermove listener applies the delta 1:1; past the top boundary a rubber-band function takes over - each extra pixel moves the sheet less, the classic resistance curve mobile OSes use. Release logic reads the flick velocity, sampled from the last two pointermove events as delta over timestamp, and combines it with the resting position to pick an anchor: a fast upward flick always opens fully, while a slow drift settles on the nearest of the collapsed, half and full stops.
Snap-back runs on a CSS transition with a spring-like curve for a subtle bounce, and a new pointerdown during the animation cancels it immediately so the sheet never fights your hand. The gesture code guards setPointerCapture with try/catch, because synthetic or automated pointer events can throw a NotFoundError when capture is requested - a real-world issue in embedded webviews where such events are common.
How to use this prompt
Paste the prompt with your sheet content and state the anchor heights you need - collapsed peek, half screen and full screen are the standard triple. If you use it for filters or a player queue, ask the AI to emit a callback at each anchor so you can update page state, like pausing background scroll when the sheet reaches full.
Tips for better results
Add a drag handle visual - users reach for it even though the whole surface drags. Set the rubber-band limit to roughly a third of the boundary distance so resistance is felt but never blocks. On desktop, let the ESC key and a backdrop click close from any anchor, and disable body scroll only while the sheet is fully open, otherwise the page jumps when the scrollbar disappears.