Repository: excalidraw/excalidraw
File: src/components/App.tsx (TypeScript)

Code before:
        hitElementIndex = index;
      }
      return (
        element.link &&
        isPointHittingLinkIcon(
          element,
          this.state,
          [scenePointer.x, scenePointer.y],
          this.isMobile || isIPad,
        ) &&
        index <= hitElementIndex
      );
    });
  };

  private redirectToLink = () => {
    const draggedDistance = distance2d(
      this.lastPointerDown!.clientX,
      this.lastPointerDown!.clientY,
      this.lastPointerUp!.clientX,
      this.lastPointerUp!.clientY,
    );
    if (
      // strict check if not on iPad or Mobile to ensure pointerdown
      //  and pointerup is same point
      (!(this.isMobile || isIPad) && draggedDistance !== 0) ||
      draggedDistance > DRAGGING_THRESHOLD
    ) {
      return;
    }
    const lastPointerDownCoords = viewportCoordsToSceneCoords(
      this.lastPointerDown!,
      this.state,
    );
    const lastPointerDownHittingLinkIcon = isPointHittingLinkIcon(
      this.hitLinkElement!,
      this.state,
      [lastPointerDownCoords.x, lastPointerDownCoords.y],
      this.isMobile || isIPad,
    );
    const lastPointerUpCoords = viewportCoordsToSceneCoords(
      this.lastPointerUp!,
      this.state,
    );
    const LastPointerUpHittingLinkIcon = isPointHittingLinkIcon(
      this.hitLinkElement!,
      this.state,
      [lastPointerUpCoords.x, lastPointerUpCoords.y],
      this.isMobile || isIPad,
    );
    if (lastPointerDownHittingLinkIcon && LastPointerUpHittingLinkIcon) {

Review comment (suggestion):
I hope I am reading it right, won't this mean that for desktop devices when dragging distance is not zero, it will allow threshold?
To make it clear
lets change the assertion to positive -> check for threshold only for mobile / ipad

Code after:
      if (hitElement && element.id === hitElement.id) {
        hitElementIndex = index;
      }
      return (
        element.link &&
        isPointHittingLinkIcon(
          element,
          this.state,
          [scenePointer.x, scenePointer.y],
          this.isMobile,
        ) &&
        index <= hitElementIndex
      );
    });
  };

  private redirectToLink = (
    event: React.PointerEvent<HTMLCanvasElement>,
    isTouchScreen: boolean,
  ) => {
    const draggedDistance = distance2d(
      this.lastPointerDown!.clientX,
      this.lastPointerDown!.clientY,
      this.lastPointerUp!.clientX,
      this.lastPointerUp!.clientY,
    );
    if (
      !this.hitLinkElement ||
      // For touch screen allow dragging threshold else strict check
      (isTouchScreen && draggedDistance > DRAGGING_THRESHOLD) ||
      (!isTouchScreen && draggedDistance !== 0)
    ) {
      return;
    }
    const lastPointerDownCoords = viewportCoordsToSceneCoords(
      this.lastPointerDown!,
      this.state,
    );
    const lastPointerDownHittingLinkIcon = isPointHittingLinkIcon(
      this.hitLinkElement!,
      this.state,
      [lastPointerDownCoords.x, lastPointerDownCoords.y],
      this.isMobile,
    );
    const lastPointerUpCoords = viewportCoordsToSceneCoords(
      this.lastPointerUp!,
      this.state,
    );
    const LastPointerUpHittingLinkIcon = isPointHittingLinkIcon(
      this.hitLinkElement!,
      this.state,