fix(frontend): use closest() to skip pointer capture on annotation children

When a child element inside an annotation div (e.g. the delete button)
was clicked, the AnnotationLayer's pointerdown handler would call
setPointerCapture, preventing the child's click event from firing.
Using closest('[data-annotation]') instead of checking dataset.annotation
on the target directly fixes delete buttons inside annotation elements.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-24 08:26:26 +01:00
parent ea1c097ae0
commit 06e846f2f8

View File

@@ -46,8 +46,7 @@ function getNormalizedCoords(event: PointerEvent, element: HTMLElement): { x: nu
function handlePointerDown(event: PointerEvent) {
if (!canAnnotate) return;
const target = event.target as HTMLElement;
if (target.dataset.annotation !== undefined) return;
if ((event.target as HTMLElement).closest('[data-annotation]')) return;
const container = event.currentTarget as HTMLElement;
container.setPointerCapture(event.pointerId);