calculateUpdatedTarget

Slide
stable

Compute the minimum scroll offset needed to bring a selected slide item fully into view within its container, with a 40% item-size buffer on each side. Returns the current scroll position unchanged if the item is already visible.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

{selectedElement, containerElement, isRtl, isHorizontal}
required
{ selectedElement: HTMLElement containerElement: HTMLElement isRtl: boolean isHorizontal: boolean }

API

Return value

The value returned by this util.

The target scroll position in pixels to apply to containerElement.

Usage

Examples

Ready-to-paste usage snippets.

Scroll the active chip into view

typescript