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
This commit is contained in:
sagit
2026-03-13 17:04:54 +08:00
committed by GitHub
parent 2e05df288b
commit f1cad30f44
@@ -61,6 +61,9 @@ function DialogContent({
className,
)}
data-slot="dialog-content"
onCloseAutoFocus={(e) => {
e.preventDefault();
}}
{...props}
>
{children}