From f1cad30f44bed5cf217c13e9433ce81d0030a269 Mon Sep 17 00:00:00 2001 From: sagit <36596628+Sagit-chu@users.noreply.github.com> Date: Fri, 13 Mar 2026 17:04:54 +0800 Subject: [PATCH] fix(dialog): prevent auto focus restore on close to avoid page scroll (#315) When a modal is closed, Radix Dialog by default restores focus to the trigger element. This causes the page to scroll to that element if it's not in the viewport, leading to unexpected scrolling behavior after editing forwards or other items. Entire-Checkpoint: 78b48b74a841 --- vite-frontend/src/components/ui/dialog.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vite-frontend/src/components/ui/dialog.tsx b/vite-frontend/src/components/ui/dialog.tsx index a3f059f..f726608 100644 --- a/vite-frontend/src/components/ui/dialog.tsx +++ b/vite-frontend/src/components/ui/dialog.tsx @@ -61,6 +61,9 @@ function DialogContent({ className, )} data-slot="dialog-content" + onCloseAutoFocus={(e) => { + e.preventDefault(); + }} {...props} > {children}