From af46aabe03eea67be5f3f179d6123009a7eaa3af Mon Sep 17 00:00:00 2001 From: Simon Baillet Date: Mon, 16 Jun 2025 15:18:43 +0200 Subject: [PATCH] fix: Out-of-viewport dialog can be dragged back in Allow dragging up a dialog that is out of the viewport's bottom Allow dragging left a dialog that is out of the viewport's right Closes #8090 --- components/lib/dialog/Dialog.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/lib/dialog/Dialog.js b/components/lib/dialog/Dialog.js index ab40d8fa4e..03336e00ba 100644 --- a/components/lib/dialog/Dialog.js +++ b/components/lib/dialog/Dialog.js @@ -144,7 +144,7 @@ export const Dialog = React.forwardRef((inProps, ref) => { dialogRef.current.style.left = leftPos - leftMargin + 'px'; } - if (topPos >= props.minY && topPos + height < viewport.height) { + if (topPos >= props.minY && (deltaY < 0 || topPos + height < viewport.height)) { lastPageY.current = event.pageY; dialogRef.current.style.top = topPos - topMargin + 'px'; } @@ -211,11 +211,11 @@ export const Dialog = React.forwardRef((inProps, ref) => { newHeight = newHeight + deltaY; } - if ((!minWidth || newWidth > minWidth) && offset.left + newWidth < viewport.width) { + if ((!minWidth || newWidth > minWidth) && (deltaX < 0 || offset.left + newWidth < viewport.width)) { dialogRef.current.style.width = newWidth + 'px'; } - if ((!minHeight || newHeight > minHeight) && offset.top + newHeight < viewport.height) { + if ((!minHeight || newHeight > minHeight) && (deltaY < 0 || offset.top + newHeight < viewport.height)) { dialogRef.current.style.height = newHeight + 'px'; }