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:
@@ -46,8 +46,7 @@ function getNormalizedCoords(event: PointerEvent, element: HTMLElement): { x: nu
|
|||||||
function handlePointerDown(event: PointerEvent) {
|
function handlePointerDown(event: PointerEvent) {
|
||||||
if (!canAnnotate) return;
|
if (!canAnnotate) return;
|
||||||
|
|
||||||
const target = event.target as HTMLElement;
|
if ((event.target as HTMLElement).closest('[data-annotation]')) return;
|
||||||
if (target.dataset.annotation !== undefined) return;
|
|
||||||
|
|
||||||
const container = event.currentTarget as HTMLElement;
|
const container = event.currentTarget as HTMLElement;
|
||||||
container.setPointerCapture(event.pointerId);
|
container.setPointerCapture(event.pointerId);
|
||||||
|
|||||||
Reference in New Issue
Block a user