Skip to content

Commit

Permalink
Minor improviement
Browse files Browse the repository at this point in the history
  • Loading branch information
AVGVSTVS96 committed Jan 13, 2025
1 parent 8c0528a commit 587fd51
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/utils/handleMouseDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ export const handleMouseDown =
// Use generic type to support any HTML element
<T extends Element>({ href }: HandleMouseDownProps) =>
(e: React.MouseEvent<T>) => {
if (e.button !== 0) return;
if (href) { window.location.href = href; }
if (href &&
e.button === 0 &&
!e.ctrlKey &&
!e.shiftKey
) {
e.preventDefault();
window.location.href = href;
} else {
return;
}
};

0 comments on commit 587fd51

Please sign in to comment.