@@ -340,28 +340,37 @@ function AnimatedOrb({ scale = 1 }: AnimatedOrbProps) {
340340 let scrollTimeout : NodeJS . Timeout ;
341341
342342 const handleScroll = ( e : WheelEvent ) => {
343- e . preventDefault ( ) ; // Prevent page scroll when over the orb
344-
345- // Calculate scroll velocity
346- const scrollDelta = e . deltaY * 0.001 ;
347- scrollVelocity . current += scrollDelta ;
348-
349- // Add to target rotation
350- targetScrollRotation . current += scrollDelta * 2 ;
343+ // Check if the user is interacting with an interactive element
344+ const target = e . target as HTMLElement ;
345+ const isInteractiveElement = target . closest (
346+ 'input, textarea, select, button, [role="combobox"], [role="listbox"], ' +
347+ '[data-radix-collection-item], [data-state], .overflow-auto, .overflow-y-auto, ' +
348+ '.overflow-x-auto, .overflow-scroll, .overflow-y-scroll, .overflow-x-scroll' ,
349+ ) ;
350+
351+ // Only apply the orb effect if not scrolling on an interactive element
352+ if ( ! isInteractiveElement ) {
353+ // Calculate scroll velocity for orb rotation
354+ const scrollDelta = e . deltaY * 0.001 ;
355+ scrollVelocity . current += scrollDelta ;
356+
357+ // Add to target rotation
358+ targetScrollRotation . current += scrollDelta * 2 ;
359+
360+ // Clear existing timeout
361+ if ( scrollTimeout ) {
362+ clearTimeout ( scrollTimeout ) ;
363+ }
351364
352- // Clear existing timeout
353- if ( scrollTimeout ) {
354- clearTimeout ( scrollTimeout ) ;
365+ // Start decay after scrolling stops
366+ scrollTimeout = setTimeout ( ( ) => {
367+ scrollVelocity . current = 0 ;
368+ } , 150 ) ;
355369 }
356-
357- // Start decay after scrolling stops
358- scrollTimeout = setTimeout ( ( ) => {
359- scrollVelocity . current = 0 ;
360- } , 150 ) ;
361370 } ;
362371
363372 // Use wheel event for better scroll detection
364- window . addEventListener ( 'wheel' , handleScroll , { passive : false } ) ;
373+ window . addEventListener ( 'wheel' , handleScroll , { passive : true } ) ;
365374
366375 return ( ) => {
367376 window . removeEventListener ( 'wheel' , handleScroll ) ;
0 commit comments