@atlaskit/renderer
Version:
Renderer component
17 lines (16 loc) • 986 B
TypeScript
import type { DocNode } from '@atlaskit/adf-schema';
/**
* useScrollToBlock - Handler for block link scrolling in the renderer with expand support
*
* This hook enables scroll-to-block functionality when blocks may be hidden inside collapsed expands.
* It searches the ADF document for the target block, identifies any parent expand nodes,
* expands them if needed, and waits for layout stability before scrolling to the block.
*
* This implementation waits for the container to stabilize (no layout shifts) before scrolling,
* which prevents issues with images loading, dynamic content, or other async operations that
* cause layout changes.
*
* @param containerRef - Optional ref to the renderer container (RendererStyleContainer)
* @param adfDoc - The ADF document to search for nodes and expand parents
*/
export declare const useScrollToBlock: (containerRef?: React.RefObject<HTMLDivElement>, adfDoc?: DocNode, scrollToBlock?: (element: HTMLElement) => void) => void;