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

Function scrollAlongAxis

packages/react-aria-components/src/Sheet.tsx:1111–1114  ·  view source on GitHub ↗
(element: HTMLElement, axis: Axis, value: number, smooth = false)

Source from the content-addressed store, hash-verified

1109}
1110
1111function scrollAlongAxis(element: HTMLElement, axis: Axis, value: number, smooth = false) {
1112 let behavior: ScrollBehavior | undefined = smooth && !reduceMotion() ? 'smooth' : undefined;
1113 element.scrollTo(axis === 'y' ? {top: value, behavior} : {left: value, behavior});
1114}
1115
1116function scrollDetentIntoView(
1117 scroller: HTMLElement,

Callers 2

Sheet.tsxFile · 0.85
scrollToRestFunction · 0.85

Calls 1

reduceMotionFunction · 0.85

Tested by

no test coverage detected