@@ -284,33 +284,31 @@ const DrawerPopup: React.ForwardRefRenderFunction<
284284 break ;
285285 }
286286 }
287- // Use currentSize if available (from resizing), otherwise use original or default width/height
287+ // Use currentSize if available (from resizing), otherwise use width/height with proper fallback to defaults
288288 if ( isHorizontal ) {
289289 let finalWidth : number | string ;
290290 if ( currentSize !== undefined ) {
291+ // Highest priority: user dragged size
291292 finalWidth = currentSize ;
292- } else if ( resizable && ! resizable . onResize && defaultWidth !== undefined ) {
293- // Uncontrolled mode: resizable exists but no onResize callback, use defaultWidth
294- finalWidth = defaultWidth ;
295- } else {
296- // Controlled mode or no resizable: use width
293+ } else if ( width !== undefined ) {
294+ // Second priority: explicitly provided width
297295 finalWidth = width ;
296+ } else {
297+ // Lowest priority: default width fallback
298+ finalWidth = defaultWidth ;
298299 }
299300 wrapperStyle . width = parseWidthHeight ( finalWidth ) ;
300301 } else {
301302 let finalHeight : number | string ;
302303 if ( currentSize !== undefined ) {
304+ // Highest priority: user dragged size
303305 finalHeight = currentSize ;
304- } else if (
305- resizable &&
306- ! resizable . onResize &&
307- defaultHeight !== undefined
308- ) {
309- // Uncontrolled mode: resizable exists but no onResize callback, use defaultHeight
310- finalHeight = defaultHeight ;
311- } else {
312- // Controlled mode or no resizable: use height
306+ } else if ( height !== undefined ) {
307+ // Second priority: explicitly provided height
313308 finalHeight = height ;
309+ } else {
310+ // Lowest priority: default height fallback
311+ finalHeight = defaultHeight ;
314312 }
315313 wrapperStyle . height = parseWidthHeight ( finalHeight ) ;
316314 }
@@ -326,24 +324,23 @@ const DrawerPopup: React.ForwardRefRenderFunction<
326324 const [ maxSize , setMaxSize ] = React . useState ( 0 ) ;
327325 const wrapperRef = React . useRef < HTMLDivElement > ( null ) ;
328326
329- // Update currentSize based on width/height and current placement
327+ // Update currentSize based on width/height and current placement with proper priority
330328 const updateCurrentSize = React . useCallback ( ( ) => {
331- let targetSize = isHorizontal ? width : height ;
329+ let targetSize : number | string | undefined ;
332330
333- // In uncontrolled mode, use default values if targetSize is not a number
334- if ( typeof targetSize !== 'number' && resizable && ! resizable . onResize ) {
335- const defaultSize = isHorizontal ? defaultWidth : defaultHeight ;
336- if ( typeof defaultSize === 'number' ) {
337- targetSize = defaultSize ;
338- }
331+ // Apply priority: width/height takes precedence over defaultWidth/defaultHeight
332+ if ( isHorizontal ) {
333+ targetSize = width !== undefined ? width : defaultWidth ;
334+ } else {
335+ targetSize = height !== undefined ? height : defaultHeight ;
339336 }
340337
341338 if ( typeof targetSize === 'number' ) {
342339 setCurrentSize ( targetSize ) ;
343340 } else {
344341 setCurrentSize ( undefined ) ;
345342 }
346- } , [ isHorizontal , width , height , resizable , defaultWidth , defaultHeight ] ) ;
343+ } , [ isHorizontal , width , height , defaultWidth , defaultHeight ] ) ;
347344
348345 React . useEffect ( ( ) => {
349346 updateCurrentSize ( ) ;
0 commit comments