code: function closestScrollableElement(element) {
    if (!element) {
      return getDocumentScrollingElement();
    }
  
    const position = getComputedStyle(element).getPropertyValue('position');
    const excludeStaticParents = position === 'absolute';
  
    const scrollableElement = closest(element, (parent) => {
      if (excludeStaticParents && isStaticallyPositioned(parent)) {
        return false;
      }
      return hasOverflow(parent);
    });
  
    if (position === 'fixed' || !scrollableElement) {
      return getDocumentScrollingElement();
    } else {
      return scrollableElement;
    }
  }
docs: Finds closest scrollable element
  @param {HTMLElement} element
  @return {HTMLElement}
  @private