 MouseEvent &&
      event.clientX >= rect.left &&
      event.clientY >= rect.top
    ) {
      // The event probably happened inside the bounding rect...
      return { x: event.clientX, y: event.clientY };
    }

    // Offset to the middle of the element
    const x = rect.x + rect.width / 2;
    // Placed at the bottom of the element
    const y = rect.y + rect.height;
    return { x, y };
  }

  /**
   * @param {Event} event
   */
  function deriveAction(event) {
    const target = /** @type {HTMLElem