mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 16:06:36 +08:00
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.
This commit is contained in:
@@ -145,6 +145,7 @@ export function ModalContent({
|
||||
|
||||
return (
|
||||
<BaseDialogContent
|
||||
{...props}
|
||||
className={cn(
|
||||
mapSize(resolvedSize),
|
||||
context?.classNames?.base,
|
||||
@@ -157,7 +158,9 @@ export function ModalContent({
|
||||
className,
|
||||
)}
|
||||
showCloseButton={false}
|
||||
{...props}
|
||||
onCloseAutoFocus={(e) => {
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
{renderedChildren}
|
||||
</BaseDialogContent>
|
||||
|
||||
Reference in New Issue
Block a user