From 3840396abc1bc221954b07e7d14e48d740960ad8 Mon Sep 17 00:00:00 2001 From: Oleksandr Danylchenko Date: Tue, 15 Oct 2024 13:31:49 +0300 Subject: [PATCH] Removed the closure filtering by a reason --- .../src/TextAnnotatorPopup/TextAnnotatorPopup.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx b/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx index 3a3272e0..c7101793 100644 --- a/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx +++ b/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx @@ -49,9 +49,10 @@ export const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => { const { refs, floatingStyles, update, context } = useFloating({ placement: isMobile() ? 'bottom' : 'top', open: isOpen, - onOpenChange: (open, _event, reason) => { - if (!open && (reason === 'escape-key' || reason === 'focus-out')) { - setOpen(open); + onOpenChange: (open) => { + setOpen(open); + + if (!open) { r?.cancelSelected(); } }, @@ -154,4 +155,4 @@ export const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => { ) : null; -} \ No newline at end of file +}