Custom scroller / scroll handler override hook
A hook that replaces how the grid's viewport applies scroll input, beyond observing scroll events (GRID-A06-F19). The app receives the viewport element and a grid scroll handler, and can intercept wheel, touch and keyboard scrolling. Typical uses are rAF throttling, momentum or kinetic touch scrolling, snapping to row boundaries, and integration with an external scroll library. The hook returns a cleanup function.
Planned. This page shows the specification from issue #211. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid with 100,000 virtualized rows using the default scroller and a live scroll event log.
Expected behavior
Switching scrollers re-mounts the hook and calls the previous cleanup. Snap-to-row always settles on a row boundary. The rAF scroller coalesces wheel events. Header and pinned sections stay in sync, virtualization renders the correct rows, and scroll events still fire with accurate positions.
Planned API surface
gridOptions.customScroller: (ctx: { viewport: HTMLElement, applyScroll(top: number, left: number): void, getScroll(): { top, left }, scrollHandler(evt: Event): void, rowHeight: number }) => (() => void) | voidapi.core.scrollTo({ top?, left? }) (uses the custom scroller when present)Existing scroll events (GRID-A06-F19) still fireAcceptance criteria
- Custom scroller fully controls scroll application; the grid does not also apply the default scroll (pending)
- applyScroll keeps the header, pinned sections and virtualization in sync (pending)
- Cleanup function runs on scroller change and grid destroy (no leaked listeners) (pending)
- Keyboard navigation that moves focus off-screen still scrolls through the custom scroller (pending)
- Passive event listener usage documented for performance (pending)