From 6974fd0c3d1ed21f971d4548b0a9d55c7c33c926 Mon Sep 17 00:00:00 2001 From: Stef Nado Date: Mon, 13 Oct 2025 20:07:08 -0400 Subject: [PATCH] Update annotation_control.ts --- src/annotation_control.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/annotation_control.ts b/src/annotation_control.ts index f1f4a92..7389cd6 100644 --- a/src/annotation_control.ts +++ b/src/annotation_control.ts @@ -55,13 +55,17 @@ export class AnnotationControl { } addEventListeners() { - this.annotation_div.addEventListener('mousedown', (event:MouseEvent) => { + const linkInteractionHandler = (event: MouseEvent | TouchEvent) => { if (event.target && (event.target as HTMLElement).tagName === 'A') { this.clickedLink = true; } else { this.clickedLink = false; } - }); + }; + + this.annotation_div.addEventListener('mousedown', linkInteractionHandler); + this.annotation_div.addEventListener('touchstart', linkInteractionHandler, { passive: true }); + // Prevent click event propagation to parent this.annotation_div.addEventListener('click', (event:MouseEvent) => { @@ -69,6 +73,8 @@ export class AnnotationControl { return; } else { event.stopPropagation(); + // Explicitly focus to help mobile keyboards appear, especially on Android. + this.annotation_div.focus(); } });