ensureVisible function
Last updated: 2026-03-05T20:45:07.036Z
Metrics
LOC: 10
Complexity: 4
Params: 1
Signature
ensureVisible(el: Element): : void
Summary
Scrolls element into view if it lies outside the visible viewport. Uses instant scrolling to avoid animations that would delay replay timing.
Source Code
function ensureVisible(el: Element): void {
const rect = el.getBoundingClientRect();
const inViewport =
rect.top >= 0 &&
rect.bottom <=
(window.innerHeight || document.documentElement.clientHeight);
if (!inViewport) {
el.scrollIntoView({ behavior: "instant", block: "center" });
}
}
No outgoing dependencies.
Impact (Incoming)
| Source | Type |
|---|---|
| handleFill | calls |
| handleClick | calls |
| handleSelect | calls |
| handleCheck | calls |
| handleClear | calls |