@@ -178,7 +178,11 @@ const Draggable: React.FC<TDraggableProps> = ({
178178 setIsDragging ( false ) ;
179179 isResizing . current = false ;
180180 if ( draggableContentBody ?. style ) {
181- Object . assign ( draggableContentBody . style , previousStyle ) ;
181+ try {
182+ Object . assign ( draggableContentBody . style , previousStyle ) ;
183+ } catch {
184+ // no need to handle this error
185+ }
182186 draggableContentBody . style . pointerEvents = previousPointerEvent ?? 'unset' ;
183187 }
184188 if ( boundaryRef ) {
@@ -196,7 +200,12 @@ const Draggable: React.FC<TDraggableProps> = ({
196200 return (
197201 < div
198202 className = { `draggable ${ isDragging ? 'dragging' : '' } ` }
199- style = { { position : 'absolute' , top : position . y , left : position . x , zIndex } }
203+ style = { {
204+ position : 'absolute' ,
205+ top : typeof position . y === 'number' ? position . y : 0 ,
206+ left : typeof position . x === 'number' ? position . x : 0 ,
207+ zIndex : typeof zIndex === 'number' ? zIndex : 0 ,
208+ } }
200209 onMouseDown = { ( ) => calculateZindex ( { setZIndex } ) }
201210 onKeyDown = { ( ) => calculateZindex ( { setZIndex } ) }
202211 data-testid = 'dt_react_draggable'
@@ -206,7 +215,10 @@ const Draggable: React.FC<TDraggableProps> = ({
206215 ref = { draggableRef }
207216 className = 'draggable-content'
208217 data-testid = 'dt_react_draggable_content'
209- style = { { width : size . width , height : size . height } }
218+ style = { {
219+ width : typeof size . width === 'number' ? size . width : 0 ,
220+ height : typeof size . height === 'number' ? size . height : 0 ,
221+ } }
210222 >
211223 < div
212224 id = 'draggable-content__header'
0 commit comments