From 2d1fb69f02fcb05d9906c0f37a1766df489f8cff Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Mon, 3 Mar 2025 22:27:39 +0100 Subject: [PATCH] fix(reply modal): dragging modal could select text behind it --- src/components/reply-modal/reply-modal.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index 53bec575..51cae25b 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -151,7 +151,15 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s })); const bind = useDrag( - ({ offset: [ox, oy] }) => { + ({ active, event, offset: [ox, oy] }) => { + if (active) { + event.preventDefault(); + document.body.style.userSelect = 'none'; + document.body.style.webkitUserSelect = 'none'; + } else { + document.body.style.userSelect = ''; + document.body.style.webkitUserSelect = ''; + } api.start({ x: ox, y: oy, immediate: true }); }, {