Attachment Modal: Fix drag and drop (#2414)

This commit is contained in:
Alexander Zinchuk 2023-01-30 15:55:27 +01:00
parent 6b5b9d7a2f
commit a7a716f161

View File

@ -233,12 +233,12 @@ const AttachmentModal: FC<OwnProps & StateProps> = ({
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;
}