Avoid automatic scroll jump when dragging a resize handle in a Gutenberg block

Apparently, this is the standard behavior of the library on which the ResizableBox component is based:

https://github.com/bokuweb/re-resizable/issues/727

To fix my issue I had to add the following code to my block:

import {useRef} from '@wordpress/element';

// Refs used to retain block's scroll position while dragging the resize handle.
const parentScrollOffsetX = useRef(0)
const parentScrollOffsetY = useRef(0)

// Store the current scroll position when resizing starts.
const handleResizeStart = (event, direction, ref) => {
    parentScrollOffsetX.current = ref.parentElement?.scrollLeft || 0
    parentScrollOffsetY.current = ref.parentElement?.scrollTop || 0
};

// Maintain the current scroll position while resizing.
const handleResize = (event, direction, ref, delta) => {
    ref.parentElement.scrollTo(parentScrollOffsetX.current, parentScrollOffsetY.current)
};

<ResizableBox
    size={{ width: currentWidth }}
    minWidth="250px"
    maxWidth="500px"
    lockAspectRatio={false}
    enable={{ top: false, right: false, bottom: false, left: true }}
    onResizeStart={handleResizeStart}
    onResize={handleResize}
    onResizeStop={handleResizeStop}
>
    <div className="exhibit-item">
        <InnerBlocks
            allowedBlocks={ALLOWED_BLOCKS}
            template={TEMPLATE}
        />
    </div>
</ResizableBox>

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino