Skip to content

Commit

Permalink
feat(tabs): listen mouse* events on $nav instead of window
Browse files Browse the repository at this point in the history
  • Loading branch information
gitwoz committed Sep 2, 2024
1 parent 2a00449 commit 599a3d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/SquareTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ export const SquareTabs: React.FC<React.PropsWithChildren<SquareTabsProps>> & {
calculateGradient()

$nav.addEventListener('scroll', calculateGradient)
window.addEventListener('mousemove', handleMouseMove)
window.addEventListener('mouseup', handleMouseUp)
$nav.addEventListener('mousemove', handleMouseMove)
$nav.addEventListener('mouseup', handleMouseUp)

return () => {
$nav.removeEventListener('scroll', calculateGradient)
window.removeEventListener('mousemove', handleMouseMove)
window.removeEventListener('mouseup', handleMouseUp)
$nav.removeEventListener('mousemove', handleMouseMove)
$nav.removeEventListener('mouseup', handleMouseUp)
}
}, [$nav, $container, isDragging])

Expand Down

0 comments on commit 599a3d0

Please sign in to comment.