diff --git a/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx b/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx index 9df3e39e..cd0c94b0 100644 --- a/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx +++ b/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx @@ -68,9 +68,10 @@ export const TextAnnotatorPopup: FC = (props) => { 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) { handleClose(); } },