diff --git a/src/components/middle/composer/AttachmentModal.tsx b/src/components/middle/composer/AttachmentModal.tsx index 12ed112b2..59242afc8 100644 --- a/src/components/middle/composer/AttachmentModal.tsx +++ b/src/components/middle/composer/AttachmentModal.tsx @@ -233,12 +233,12 @@ const AttachmentModal: FC = ({ const { relatedTarget: toTarget, target: fromTarget } = e; // Esc button pressed during drag event - if ((fromTarget as HTMLDivElement).matches(styles.dropTarget) && !toTarget) { + if ((fromTarget as HTMLDivElement).matches(`.${styles.dropTarget}`) && !toTarget) { hideTimeoutRef.current = window.setTimeout(unmarkHovered, DROP_LEAVE_TIMEOUT_MS); } // Prevent DragLeave event from firing when the pointer moves inside the AttachmentModal drop target - if (fromTarget && (fromTarget as HTMLElement).closest(styles.hovered)) { + if (fromTarget && (fromTarget as HTMLElement).closest(`.${styles.hovered}`)) { return; }