From 2b5aca4b0051e7b5cbded5814bb0bca09f34256f Mon Sep 17 00:00:00 2001 From: Silberengel Date: Wed, 12 Nov 2025 21:21:11 +0100 Subject: [PATCH] Fixed click bug from reply form --- src/components/NoteStats/index.tsx | 4 ++-- .../NotificationItem/Notification.tsx | 22 ++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/components/NoteStats/index.tsx b/src/components/NoteStats/index.tsx index ffea79a..30f48b3 100644 --- a/src/components/NoteStats/index.tsx +++ b/src/components/NoteStats/index.tsx @@ -70,7 +70,7 @@ export default function NoteStats({ if (isSmallScreen) { return ( -
+
e.stopPropagation()}> {displayTopZapsAndLikes && ( <> @@ -96,7 +96,7 @@ export default function NoteStats({ } return ( -
+
e.stopPropagation()}> {displayTopZapsAndLikes && ( <> diff --git a/src/components/NotificationList/NotificationItem/Notification.tsx b/src/components/NotificationList/NotificationItem/Notification.tsx index 5cdfe12..245a331 100644 --- a/src/components/NotificationList/NotificationItem/Notification.tsx +++ b/src/components/NotificationList/NotificationItem/Notification.tsx @@ -47,7 +47,27 @@ export default function Notification({ [isNew, isNotificationRead, notificationId] ) - const handleClick = () => { + const handleClick = (e: React.MouseEvent) => { + // Don't navigate if clicking on interactive elements (buttons, links, etc.) + const target = e.target as HTMLElement + if (target.closest('button') || target.closest('[role="button"]') || target.closest('a')) { + return + } + + // Don't navigate if clicking within NoteStats (which contains the ReplyButton) + // NoteStats is rendered inside the notification, so we need to check for it + if (target.closest('[data-note-stats]')) { + return + } + + // Don't navigate if a modal/dialog/sheet is currently open + // Check for Radix UI dialog/sheet elements in the DOM + // Radix UI uses data-radix-dialog-content for the dialog content + const hasOpenModal = document.querySelector('[data-radix-dialog-content][data-state="open"]') + if (hasOpenModal) { + return + } + markNotificationAsRead(notificationId) if (targetEvent) { navigateToNote(toNote(targetEvent.id))