Skip to content

Commit 1e7b69d

Browse files
SimbayyySimon Baillet
andauthored
fix: Out-of-viewport dialog can be dragged back in (#8091)
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 Co-authored-by: Simon Baillet <sbaillet@medelpharm.com>
1 parent 644d85e commit 1e7b69d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

components/lib/dialog/Dialog.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const Dialog = React.forwardRef((inProps, ref) => {
144144
dialogRef.current.style.left = leftPos - leftMargin + 'px';
145145
}
146146

147-
if (topPos >= props.minY && topPos + height < viewport.height) {
147+
if (topPos >= props.minY && (deltaY < 0 || topPos + height < viewport.height)) {
148148
lastPageY.current = event.pageY;
149149
dialogRef.current.style.top = topPos - topMargin + 'px';
150150
}
@@ -211,11 +211,11 @@ export const Dialog = React.forwardRef((inProps, ref) => {
211211
newHeight = newHeight + deltaY;
212212
}
213213

214-
if ((!minWidth || newWidth > minWidth) && offset.left + newWidth < viewport.width) {
214+
if ((!minWidth || newWidth > minWidth) && (deltaX < 0 || offset.left + newWidth < viewport.width)) {
215215
dialogRef.current.style.width = newWidth + 'px';
216216
}
217217

218-
if ((!minHeight || newHeight > minHeight) && offset.top + newHeight < viewport.height) {
218+
if ((!minHeight || newHeight > minHeight) && (deltaY < 0 || offset.top + newHeight < viewport.height)) {
219219
dialogRef.current.style.height = newHeight + 'px';
220220
}
221221

0 commit comments

Comments
 (0)