Fix: NavDropdown link navigation with stopPropagation
Prevent click-outside event handler from interfering with link navigation by adding stopPropagation to both section and flat link click handlers. Fixes issue where clicking a dropdown link from a product page would not navigate. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
912dcc6ab3
commit
ac10b33207
@@ -155,7 +155,11 @@
|
||||
"Bash(psql postgresql://postgres:craft2prints@192.168.0.190:5432/craft2prints -c ' *)",
|
||||
"Bash(node scripts/add-indexes.js)",
|
||||
"Bash(curl -s http://127.0.0.1:3000)",
|
||||
"Bash(curl -s http://127.0.0.1:3000/products)"
|
||||
"Bash(curl -s http://127.0.0.1:3000/products)",
|
||||
"Bash(curl -s http://127.0.0.1:3000/products/awd-hoodie)",
|
||||
"Bash(curl -s http://127.0.0.1:3000/made-to-order)",
|
||||
"Bash(curl -s \"http://127.0.0.1:3000/products/awd-hoodie\")",
|
||||
"Bash(git commit -m 'Fix: NavDropdown link navigation with stopPropagation *)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,10 @@ export default function NavDropdown({
|
||||
<Link
|
||||
key={link.href + link.label}
|
||||
href={link.href}
|
||||
onClick={() => setOpen(false)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setOpen(false);
|
||||
}}
|
||||
className="block px-4 py-2.5 text-sm hover:bg-surface"
|
||||
>
|
||||
{link.label}
|
||||
@@ -68,7 +71,10 @@ export default function NavDropdown({
|
||||
<Link
|
||||
key={link.href + link.label}
|
||||
href={link.href}
|
||||
onClick={() => setOpen(false)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setOpen(false);
|
||||
}}
|
||||
className="block px-4 py-3 text-sm hover:bg-surface"
|
||||
>
|
||||
{link.label}
|
||||
|
||||
Reference in New Issue
Block a user