diff options
| author | Fuwn <[email protected]> | 2026-02-08 01:12:59 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-08 01:12:59 -0800 |
| commit | 63a94f54c67f0f1bf01e17ca92e0b1ada8f0f961 (patch) | |
| tree | 94b6a11a4818d5e641b115910bf9fefe118c6387 /apps | |
| parent | fix: notification count alignment — add flex to button so ml-auto pushes co... (diff) | |
| download | asa.news-63a94f54c67f0f1bf01e17ca92e0b1ada8f0f961.tar.xz asa.news-63a94f54c67f0f1bf01e17ca92e0b1ada8f0f961.zip | |
fix: clicking notifications button while panel is open now correctly dismisses it
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/web/app/reader/_components/notification-panel.tsx | 4 | ||||
| -rw-r--r-- | apps/web/app/reader/_components/sidebar-footer.tsx | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/apps/web/app/reader/_components/notification-panel.tsx b/apps/web/app/reader/_components/notification-panel.tsx index 216741f..ea4d052 100644 --- a/apps/web/app/reader/_components/notification-panel.tsx +++ b/apps/web/app/reader/_components/notification-panel.tsx @@ -27,9 +27,11 @@ export function NotificationPanel({ onClose }: { onClose: () => void }) { useEffect(() => { function handleClickOutside(event: MouseEvent) { + const target = event.target as Node if ( panelReference.current && - !panelReference.current.contains(event.target as Node) + !panelReference.current.contains(target) && + !(target instanceof HTMLElement && target.closest("[data-notification-toggle]")) ) { onClose() } diff --git a/apps/web/app/reader/_components/sidebar-footer.tsx b/apps/web/app/reader/_components/sidebar-footer.tsx index 94de241..90600eb 100644 --- a/apps/web/app/reader/_components/sidebar-footer.tsx +++ b/apps/web/app/reader/_components/sidebar-footer.tsx @@ -49,6 +49,7 @@ export function SidebarFooter() { <div className="relative"> <button type="button" + data-notification-toggle onClick={() => setIsNotificationPanelOpen(!isNotificationPanelOpen)} className="flex w-full items-center whitespace-nowrap px-2 py-1 text-left text-text-secondary transition-colors hover:bg-background-tertiary hover:text-text-primary" > |