From 06e846f2f823b9dc7e9cc742a2f3d586a1bb324b Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 24 Mar 2026 08:26:26 +0100 Subject: [PATCH] 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 --- frontend/src/lib/components/AnnotationLayer.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/lib/components/AnnotationLayer.svelte b/frontend/src/lib/components/AnnotationLayer.svelte index 51be80ba..aa9831cb 100644 --- a/frontend/src/lib/components/AnnotationLayer.svelte +++ b/frontend/src/lib/components/AnnotationLayer.svelte @@ -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);