UNPKG

@shopify/polaris

Version:

Shopify’s admin product component library

9 lines (8 loc) 247 B
export function scrollIntoView(element: HTMLElement, container: HTMLElement) { requestAnimationFrame(() => { if (element) { const offset = element.offsetTop - container.scrollTop; container.scrollBy({top: offset}); } }); }