Skip to content

Commit d9beee4

Browse files
committed
fixes double-scrolling
1 parent f0782e9 commit d9beee4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/web/client/src/app/_components/hero/unicorn-background.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ export function UnicornBackground() {
1313

1414
// Handle wheel events to allow scrolling while keeping mouse interactivity
1515
const handleWheel = (e: WheelEvent) => {
16+
// Prevent the default to avoid double-scrolling
17+
e.preventDefault();
1618
// Manually trigger scroll on the window
17-
// This ensures scrolling works even if the canvas captures the wheel event
1819
window.scrollBy({
1920
top: e.deltaY,
2021
left: e.deltaX,
2122
behavior: 'auto',
2223
});
2324
};
2425

25-
container.addEventListener('wheel', handleWheel, { passive: true });
26+
// Use passive: false so we can call preventDefault()
27+
container.addEventListener('wheel', handleWheel, { passive: false });
2628

2729
return () => {
2830
container.removeEventListener('wheel', handleWheel);

0 commit comments

Comments
 (0)