fix(savings-goals): don't leave body pointer-events locked after create chooser

Preventing default on the dropdown item's onSelect kept the Radix menu open
behind the dialog, leaving `pointer-events: none` on <body> after the dialog
closed. Let the menu close normally and only defer the dialog open to the next
frame.
This commit is contained in:
Víctor Falcón 2026-07-20 18:06:18 +02:00
parent e01d63732c
commit b419db3716
1 changed files with 10 additions and 10 deletions

View File

@ -67,25 +67,25 @@ export default function BudgetsIndex({
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
{/* Defer opening until the menu has closed so Radix
doesn't leave pointer-events locked on the body. */}
{/* Let the menu close itself (no preventDefault, or
it leaves pointer-events locked on the body), and
defer opening the dialog to the next frame so it
doesn't race the menu's close. */}
<DropdownMenuItem
onSelect={(e) => {
e.preventDefault();
onSelect={() =>
requestAnimationFrame(() =>
setCreateType('budget'),
);
}}
)
}
>
{__('Budget')}
</DropdownMenuItem>
<DropdownMenuItem
onSelect={(e) => {
e.preventDefault();
onSelect={() =>
requestAnimationFrame(() =>
setCreateType('goal'),
);
}}
)
}
>
{__('Savings Goal')}
</DropdownMenuItem>