downshift
Version:
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
12 lines (11 loc) • 750 B
TypeScript
/**
* Utility hook that scrolls an item from a menu into view.
* @param scrollIntoView The function that does the scroll.
* @param highlightedIndex The index of the item that should be scrolled.
* @param isOpen If the menu is open or not.
* @param menuElement The menu element.
* @param itemElements The object containing item elements.
* @param getItemId The function to get the item id from index.
* @returns Function that when called prevents the scroll.
*/
export declare function useScrollIntoView(scrollIntoView: (node: HTMLElement, menuNode: HTMLElement) => void, highlightedIndex: number, isOpen: boolean, menuElement: HTMLElement | null, itemElements: Record<string, HTMLElement>, getItemId: (index: number) => string): () => void;