@@ -247,6 +247,12 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
247247 | ( ( menuOptions : ContextMenuOption [ ] , e : Event ) => void )
248248 | null = null ;
249249
250+ /**
251+ * A dummy wheel event listener used as a workaround for a Safari scrolling issue.
252+ * Set in createDom and used for removal in dispose to ensure proper cleanup.
253+ */
254+ private dummyWheelListener : ( ( ) => void ) | null = null ;
255+
250256 /**
251257 * In a flyout, the target workspace where blocks should be placed after a
252258 * drag. Otherwise null.
@@ -787,7 +793,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
787793 // This no-op works around https://bugs.webkit.org/show_bug.cgi?id=226683,
788794 // which otherwise prevents zoom/scroll events from being observed in
789795 // Safari. Once that bug is fixed it should be removed.
790- document . body . addEventListener ( 'wheel' , function ( ) { } ) ;
796+ this . dummyWheelListener = ( ) => { } ;
797+ document . body . addEventListener ( 'wheel' , this . dummyWheelListener ) ;
791798 browserEvents . conditionalBind (
792799 this . svgGroup_ ,
793800 'wheel' ,
@@ -896,6 +903,12 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
896903 browserEvents . unbind ( this . resizeHandlerWrapper ) ;
897904 this . resizeHandlerWrapper = null ;
898905 }
906+
907+ // Remove the dummy wheel listener
908+ if ( this . dummyWheelListener ) {
909+ document . body . removeEventListener ( 'wheel' , this . dummyWheelListener ) ;
910+ this . dummyWheelListener = null ;
911+ }
899912 }
900913
901914 /**
0 commit comments