MCPcopy Create free account
hub / github.com/downshift-js/downshift / scrollIntoView

Function scrollIntoView

src/utils/scrollIntoView.ts:8–25  ·  view source on GitHub ↗
(
  node: HTMLElement | undefined,
  menuNode: HTMLElement | undefined,
)

Source from the content-addressed store, hash-verified

6 * @param {HTMLElement} menuNode the menu element of the component
7 */
8export function scrollIntoView(
9 node: HTMLElement | undefined,
10 menuNode: HTMLElement | undefined,
11) {
12 if (!node) {
13 return
14 }
15
16 const actions = compute(node, {
17 boundary: menuNode,
18 block: 'nearest',
19 scrollMode: 'if-needed',
20 })
21 actions.forEach(({el, top, left}) => {
22 el.scrollTop = top
23 el.scrollLeft = left
24 })
25}

Callers 3

useScrollIntoViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…