Skip to content

Touchscreen gestures over annotations are always interpreted as clicks #4184

@dkbarn

Description

@dkbarn

I'm using Mirador v4.0.0-rc4 and OpenSeaDragon 5.0.1, testing primarily in Firefox on a mobile touchscreen device.

I have noticed that various touchscreen gestures, such as pinch zooms, swipes, or holding your finger to pan the canvas, if performed over an annotation, are always being interpreted as a click on that annotation as soon as you lift your finger, which causes the annotation to become selected.

Steps to Reproduce:

  1. Load any manifest with an annotation that has a visible rectangular region on the canvas.
  2. On a touchscreen device, perform a pinch zoom or pan over the annotation.
  3. Release your fingers while still over the annotation.

Expected Behaviour:

OpenSeadragon emits canvas-click but with event.quick as false and isTouchEvent as true, so Mirador should treat this as a non-click and leave the annotation selection unchanged.

Actual Behaviour:

The onCanvasClick function in AnnotationsOverlay.jsx toggles annotation selection regardless of event.quick or touch gesture type. This makes normal pinch/pan gestures behave like taps.

Possible Fix?

I have not tested this, but I'm wondering if the fix could be as simple as an early exit in onCanvasClick by checking certain attributes of the event that it receives. For example, maybe something like:

  const onCanvasClick = useCallback((event) => {
    const pointerType = event.originalEvent?.pointerType;
    if ((event.isTouchEvent || pointerType === 'touch' || pointerType === 'pen') && event.quick === false) {
      return;
    }
    ...
  }

These attributes were derived from OpenSeaDragon canvas-click event, documented here: https://openseadragon.github.io/docs/OpenSeadragon.Viewer.html#.event:canvas-click

Metadata

Metadata

Assignees

No one assigned

    Labels

    annotationsannotation display / viewing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions