Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/web/src/components/Button/ButtonWithLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ export function ButtonWithLink({

...buttonProps
}: ButtonWithLinkProps) {
// If the link opens in a new tab and no rel is specified,
// default to "noopener noreferrer" to prevent tab-nabbing.
const computedRel =
rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined);

return (
<Link
href={href}
target={target}
rel={rel}
rel={computedRel}
className={`${linkClassNames}${disabled ? ' pointer-events-none' : ''}`}
{...linkProps}
>
Expand All @@ -52,3 +57,4 @@ export function ButtonWithLink({
</Link>
);
}