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:
parent
e01d63732c
commit
b419db3716
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue