diff --git a/web/src/components/ui/dropdown/DropdownBase.tsx b/web/src/components/ui/dropdown/DropdownBase.tsx
index 8f418b403..a7a03fe60 100644
--- a/web/src/components/ui/dropdown/DropdownBase.tsx
+++ b/web/src/components/ui/dropdown/DropdownBase.tsx
@@ -256,10 +256,22 @@ const DropdownMenuLink: React.FC<{
/>
);
- if (!link) return
{content}
;
+ if (!link)
+ return (
+ e.stopPropagation()}>
+ {content}
+
+ );
return (
-
+ {
+ e.stopPropagation();
+ e.preventDefault();
+ }}>
{content}
);
diff --git a/web/src/components/ui/layouts/PreventNavigation.tsx b/web/src/components/ui/layouts/PreventNavigation.tsx
index 07b980dfc..980690673 100644
--- a/web/src/components/ui/layouts/PreventNavigation.tsx
+++ b/web/src/components/ui/layouts/PreventNavigation.tsx
@@ -44,14 +44,26 @@ export const PreventNavigation: React.FC = React.memo(
* @param e The triggered event.
*/
const handleClick = useMemoizedFn((event: MouseEvent) => {
- const target = event.target as HTMLAnchorElement;
+ let target = event.target as HTMLElement;
+ let href: string | null = null;
+
+ // Traverse up the DOM tree looking for an anchor tag with href
+ while (target && !href) {
+ if (target instanceof HTMLAnchorElement && target.href) {
+ href = target.href;
+ break;
+ }
+ target = target.parentElement as HTMLElement;
+ }
if (isDirty) {
event.preventDefault();
event.stopPropagation();
+ console.log(href);
+
confirmationFn.current = () => {
- router.push(target.href);
+ if (href) router.push(href);
};
setLeavingPage(true);