Infinity;
    for (const rect of dfnRects) {
      const { top, bottom } = rect;
      const diffFromClickY = Math.abs((top + bottom) / 2 - y);
      if (diffFromClickY < minDiff) {
        minDiff = diffFromClickY;
        closestTop = top;
      }
    }

    const top = window.scrollY + closestTop + dfnRects[0].height;
    const left = x - MARGIN;
    panel.style.left = `${left}px`;
    panel.style.top = `${top}px`;

    // Find if the panel is flowing out of the window
    const panelRect = panel.getBoun