MCPcopy Create free account
hub / github.com/adobe/react-spectrum / scrollToRest

Function scrollToRest

packages/react-aria-components/src/Sheet.tsx:375–381  ·  view source on GitHub ↗
(smooth: boolean)

Source from the content-addressed store, hash-verified

373 // Open at the first custom detent when provided, otherwise the fully-entered position.
374 let initial = element.querySelector<HTMLElement>('[data-sheet-initial]');
375 let scrollToRest = (smooth: boolean) => {
376 if (initial) {
377 scrollDetentIntoView(scroller, initial, axis, after ? 'start' : 'end', smooth);
378 } else {
379 scrollAlongAxis(scroller, axis, (enteredScroll / 100) * vp, smooth);
380 }
381 };
382 if (enteredScroll === 0) {
383 // The rest position is at scroll 0, so the sheet mounts already entered. Jump to the exit first.
384 scrollAlongAxis(scroller, axis, (maxScroll / 100) * vp);

Callers 1

startEnterScrollFunction · 0.85

Calls 2

scrollDetentIntoViewFunction · 0.85
scrollAlongAxisFunction · 0.85

Tested by

no test coverage detected