From 22f9c452329ab29bcd2be6b83135a5a0f0a56882 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 31 Dec 2025 08:35:26 +0100 Subject: [PATCH] fix(annotator): delay highlight action to prevent immediate onShowAnnotation trigger (#2820) --- .../src/app/reader/components/annotator/Annotator.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx b/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx index 9adfdaf2..7f564db9 100644 --- a/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx +++ b/apps/readest-app/src/app/reader/components/annotator/Annotator.tsx @@ -379,8 +379,12 @@ const Annotator: React.FC<{ bookKey: string }> = ({ bookKey }) => { handleDismissPopupAndSelection(); break; case 'highlight': - handleHighlight(); - handleDismissPopupAndSelection(); + // Delay to ensure highlight is applied after selection is set + // so that onShowAnnotation won't be triggered immediately + setTimeout(() => { + handleHighlight(); + handleDismissPopupAndSelection(); + }, 0); break; case 'dictionary': handleDictionary();