From f5184bd6086132d5a9fbbf0adb275bfe82215448 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 12 Sep 2023 11:21:31 +0800 Subject: [PATCH] Prevent propagation from nested links --- src/components/link.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/link.jsx b/src/components/link.jsx index a77faf09..9c5184b5 100644 --- a/src/components/link.jsx +++ b/src/components/link.jsx @@ -39,6 +39,10 @@ const Link = forwardRef((props, ref) => { {...restProps} class={`${props.class || ''} ${isActive ? 'is-active' : ''}`} onClick={(e) => { + if (e.currentTarget?.parentNode?.closest('a')) { + // If this is nested inside another + e.stopPropagation(); + } if (routerLocation) states.prevLocation = routerLocation; props.onClick?.(e); }}