Skip to content

scrollHostOf

scrollHostOf(element): ScrollHost

Defined in: dom/src/dom-utils/scroll.ts:119

Finds what scrolls element vertically: the nearest ancestor with overflow-y: auto, scroll or overlay that has something to scroll, or else the page. body and html are the page whatever their overflow says (the browser hands theirs to the viewport), and an ancestor that clips (hidden, clip) is no host: nothing can scroll the chart inside it, so the page is asked.

An ancestor whose content fits (scrollHeight is not more than clientHeight) is no host either: a wrapper with overflow-x: auto alone computes to overflow-y: auto as well, grows with the chart and never scrolls, and asking it would draw every row. That is a fact of the moment: a chart that has no rows yet fits everywhere, so look again once it has its height.

Reads computed styles and sizes up the tree: call it when the mode is set and when the chart’s height changes, never while scrolling.

Element

The chart’s element (its scroller).

ScrollHost

The host.