docs: function getIndexOfItemAtY(items, scrollTarget, y, downward) {
  
    const start = downward ? 0 : items.length - 1;
    const end = downward ? items.length : 0;
    const step = downward ? 1 : -1;
  
    const topOfClientArea = scrollTarget.offsetTop + scrollTarget.clientTop;
  
    // Find the item spanning the indicated y coordinate.
    let item;
    let itemIndex = start;
    let itemTop;
    let found = false;
    while (itemIndex !== end) {
      item = items[itemIndex];
      itemTop = item.offsetTop - topOfClientArea;
      const itemBottom = itemTop + item.offsetHeight;
      if (itemTop <= y && itemBottom >= y) {
        // Item spans the indicated y coordinate.
        found = true;
        break;
      }
      itemIndex += step;
    }
  
    if (!found) {
      return null;
    }
  
    // We may have found an item whose padding spans the given y coordinate,
    // but whose content is actually above/below that point.
    // TODO: If the item has a border, then padding should be included in
    // considering a hit.
    const itemStyle = getComputedStyle(item);
    const itemPaddingTop = itemStyle.paddingTop ? parseFloat(itemStyle.paddingTop) : 0;
    const itemPaddingBottom = itemStyle.paddingBottom ? parseFloat(itemStyle.paddingBottom) : 0;
    const contentTop = itemTop + item.clientTop + itemPaddingTop;
    const contentBottom = contentTop + item.clientHeight - itemPaddingTop - itemPaddingBottom;
    if (downward && contentTop <= y || !downward && contentBottom >= y) {
      // The indicated coordinate hits the actual item content.
      return itemIndex;
    }
    else {
      // The indicated coordinate falls within the item's padding. Back up to
      // the item below/above the item we found and return that.
      return itemIndex - step;
    }
  }