Skip to content

Commit 4f7bdc6

Browse files
committed
remove scrolling in full pages
1 parent cb393e4 commit 4f7bdc6

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

src/components/design-library-list/design-preview.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ export const DesignPreview = ( {
1717
} ) => {
1818
const ref = useRef( null )
1919

20-
// Prevents scrolling using mousewheel but allows it to bubble to parent
21-
const handleWheel = e => {
22-
// Don't prevent default - let the event bubble up to parent
23-
// But stop propagation to prevent the preview content from scrolling
24-
e.stopPropagation()
25-
26-
// Make the preview content non-scrollable
27-
if ( ref.current ) {
28-
ref.current.style.overflow = 'hidden'
29-
// Reset scroll position to ensure content stays in place
30-
ref.current.scrollTop = 0
31-
}
32-
}
33-
3420
const isDragging = useRef( false )
3521
const lastY = useRef( 0 )
3622
const lastScrollTop = useRef( 0 )
@@ -69,9 +55,6 @@ export const DesignPreview = ( {
6955
return
7056
}
7157

72-
// Add the event listener without passive: false since we're not using preventDefault
73-
container.addEventListener( 'wheel', handleWheel )
74-
7558
container.addEventListener( 'mousedown', handleMouseDown )
7659
// eslint-disable-next-line @wordpress/no-global-event-listener
7760
window.addEventListener( 'mousemove', handleMouseMove )
@@ -80,8 +63,6 @@ export const DesignPreview = ( {
8063

8164
// Clean up the event listeners when the component unmounts.
8265
return () => {
83-
container.removeEventListener( 'wheel', handleWheel )
84-
8566
container.removeEventListener( 'mousedown', handleMouseDown )
8667
// eslint-disable-next-line @wordpress/no-global-event-listener
8768
window.removeEventListener( 'mousemove', handleMouseMove )

src/components/design-library-list/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ export const getAdditionalStylesForPreview = () => {
299299

300300
styles += 'body { --stk-block-wide-width: 1000px; }'
301301

302-
// Use 'auto' for scroll behavior. Let the scroll interval handle the speed.
303-
styles += 'body.preview-pages { scroll-behavior: auto; overflow-y: auto; max-height: 1500px; }'
302+
// Use overflow-y: hidden to prevent mousewheel scrolling
303+
styles += 'body.preview-pages { overflow-y: hidden; max-height: 1200px; }'
304304

305305
styles += '::-webkit-scrollbar { width: 0; }'
306306

0 commit comments

Comments
 (0)