From e194813f3be5248d03d5f03e8d1ab954316abc01 Mon Sep 17 00:00:00 2001 From: sagit <36596628+Sagit-chu@users.noreply.github.com> Date: Fri, 13 Mar 2026 17:35:18 +0800 Subject: [PATCH] fix(modal): prevent auto focus restore on close to avoid page scroll (#316) * fix(dialog): prevent auto focus restore on close to avoid page scroll 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 * fix(modal): prevent auto focus restore on close in ModalContent Ensure onCloseAutoFocus is applied after props spread to prevent override. This fixes page scroll to top after closing modal on second edit. --- vite-frontend/src/shadcn-bridge/heroui/modal.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vite-frontend/src/shadcn-bridge/heroui/modal.tsx b/vite-frontend/src/shadcn-bridge/heroui/modal.tsx index 3dab763..fd6244b 100644 --- a/vite-frontend/src/shadcn-bridge/heroui/modal.tsx +++ b/vite-frontend/src/shadcn-bridge/heroui/modal.tsx @@ -145,6 +145,7 @@ export function ModalContent({ return ( { + e.preventDefault(); + }} > {renderedChildren}