From 28ae102c022ee30fe0b58f1a24868842554b65ea Mon Sep 17 00:00:00 2001 From: sk1982 Date: Tue, 2 Apr 2024 00:35:07 -0400 Subject: [PATCH] fix: sidebar swipe when target is slider --- src/app/(with-header)/header-sidebar.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/(with-header)/header-sidebar.tsx b/src/app/(with-header)/header-sidebar.tsx index 83c5899..b104062 100644 --- a/src/app/(with-header)/header-sidebar.tsx +++ b/src/app/(with-header)/header-sidebar.tsx @@ -76,6 +76,10 @@ export const HeaderSidebar = ({ children }: HeaderSidebarProps) => { }, onSwipeStart: e => { if (e.dir === 'Down' || e.dir === 'Up') return; + + const data = (e.event.target as HTMLElement)?.dataset; + if (data?.slot === 'thumb' || data?.dragging) + return; const allMenusClosed = !isMenuOpen && !isNotificationsOpen; const xPercent = e.initial[0] / window.innerWidth; @@ -427,7 +431,7 @@ export const HeaderSidebar = ({ children }: HeaderSidebarProps) => { ); - }, [isNotificationsOpen, notificationsTranslate, user, friendRequests]); + }, [isNotificationsOpen, notificationsTranslate, user, friendRequests, notifications, router]); return (<> { leftSidebar }