diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 86033b2..63799dc 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -115,6 +115,18 @@ export function Button(props: ButtonProps) { ); } + // A jump within the page is left to the browser. next/link treats a click on + // a hash that's already in the URL as a no-op navigation, so the second + // click (or the first, on a page opened at that hash) wouldn't scroll. + if (props.href.startsWith("#")) { + return ( + + {children} + + + ); + } + // Default: internal link return (