Skip to content

Commit

Permalink
fix: button cannot be inside a button
Browse files Browse the repository at this point in the history
  • Loading branch information
clostao committed Nov 6, 2024
1 parent da5c8b7 commit 624b5e0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions frontend/src/components/common/InternalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { useRouter } from 'next/navigation';
import { handleEnterOrSpace } from '../../utils/eventHandler';

export const InternalLink = ({
children,
Expand All @@ -14,13 +15,13 @@ export const InternalLink = ({
const router = useRouter();

return (
<button
onClick={() => {
router.push(href);
}}
<span
role='button'
tabIndex={0}
onKeyDown={handleEnterOrSpace(() => router.push(href))}
className={`contents ${className}`}
>
{children}
</button>
</span>
);
};

0 comments on commit 624b5e0

Please sign in to comment.