From a48b496ba5eeeb01cf1baaa5bb5460bd817d62dd Mon Sep 17 00:00:00 2001 From: Nick Wu <38874640+wNing50@users.noreply.github.com> Date: Tue, 3 Jun 2025 22:59:49 +0800 Subject: [PATCH] fix(components): [dialog] drag into view when content is too high (#20595) --- packages/hooks/use-draggable/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/hooks/use-draggable/index.ts b/packages/hooks/use-draggable/index.ts index 0baa9fd7b4..a35d55e02a 100644 --- a/packages/hooks/use-draggable/index.ts +++ b/packages/hooks/use-draggable/index.ts @@ -28,7 +28,11 @@ export const useDraggable = ( const minLeft = -targetLeft + offsetX const minTop = -targetTop + offsetY const maxLeft = clientWidth - targetLeft - targetWidth + offsetX - const maxTop = clientHeight - targetTop - targetHeight + offsetY + const maxTop = + clientHeight - + targetTop - + (targetHeight < clientHeight ? targetHeight : 0) + + offsetY if (!overflow?.value) { moveX = Math.min(Math.max(moveX, minLeft), maxLeft)