Skip to content

Commit 2c715a5

Browse files
committed
fix: close actions dropdown when editing
1 parent 32843c2 commit 2c715a5

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎apps/web/src/components/ProjectScriptsControl.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default function ProjectScriptsControl({
138138
}: ProjectScriptsControlProps) {
139139
const addScriptFormId = React.useId();
140140
const [editingScriptId, setEditingScriptId] = useState<string | null>(null);
141+
const [actionsMenuOpen, setActionsMenuOpen] = useState(false);
141142
const [dialogOpen, setDialogOpen] = useState(false);
142143
const [name, setName] = useState("");
143144
const [command, setCommand] = useState("");
@@ -255,6 +256,7 @@ export default function ProjectScriptsControl({
255256
};
256257

257258
const openEditDialog = (script: ProjectScript) => {
259+
setActionsMenuOpen(false);
258260
setEditingScriptId(script.id);
259261
setName(script.name);
260262
setCommand(script.command);
@@ -349,7 +351,11 @@ export default function ProjectScriptsControl({
349351
<TooltipPopup side="top">Run {primaryScript.name}</TooltipPopup>
350352
</Tooltip>
351353
<GroupSeparator className="hidden @3xl/header-actions:block" />
352-
<Menu highlightItemOnHover={false}>
354+
<Menu
355+
highlightItemOnHover={false}
356+
open={actionsMenuOpen}
357+
onOpenChange={setActionsMenuOpen}
358+
>
353359
<MenuTrigger
354360
render={<Button size="icon-xs" variant="outline" aria-label="Script actions" />}
355361
>
@@ -408,7 +414,7 @@ export default function ProjectScriptsControl({
408414
</Menu>
409415
</Group>
410416
) : importableScripts.length > 0 ? (
411-
<Menu highlightItemOnHover={false}>
417+
<Menu highlightItemOnHover={false} open={actionsMenuOpen} onOpenChange={setActionsMenuOpen}>
412418
<MenuTrigger render={<Button size="xs" variant="outline" aria-label="Project actions" />}>
413419
<PlusIcon className="size-3.5" />
414420
<span className="sr-only @3xl/header-actions:not-sr-only @3xl/header-actions:ml-0.5">

0 commit comments

Comments
 (0)