function getScrollParent(node) {
  const parent = node.parentElement;

  if (parent == null) return getScrollingRoot();

  const { overflowY } = window.getComputedStyle(parent);
  const canScroll = overflowY !== 'visible' && overflowY !== 'hidden';

  if (canScroll && parent.scrollHeight > parent.clientHeight) {
    return parent;
  }

  return getScrollParent(parent);
}
Recursively finds the scroll parent of a node. The scroll parrent of a node
is the closest node that is scrollable. A node is scrollable if:
 - it is allowed to scroll via CSS ('overflow-y' not visible or hidden);
 - and its children/content are "bigger" than the node's box height.

The root of the document always scrolls by default.

@param {HTMLElement} node Any DOM element.
@return {HTMLElement} The scroll parent element.