"use client"; import type { RefObject } from "react"; import { IconDots } from "@tabler/icons-react"; import { useTranslation } from "react-i18next"; import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "@kandev/ui/dropdown-menu"; import { KanbanCardDropdownMenuItems, type KanbanCardMenuEntry, } from "@/components/kanban-card-menu-items"; type TaskActionsMenuTriggerProps = { entries: KanbanCardMenuEntry[]; testId: string; triggerRef: RefObject; open: boolean; onOpenChange: (open: boolean) => void; }; /** The "More options" dots trigger shared by the preview and detail surfaces. */ export function TaskActionsMenuTrigger({ entries, testId, triggerRef, open, onOpenChange, }: TaskActionsMenuTriggerProps) { const { t } = useTranslation(); return ( { // Consume this Escape ourselves instead of letting Radix's default // dismiss handle it: closing the menu via `onOpenChange` still // triggers Radix's synchronous focus-restoration flush, but calling // `preventDefault()` here (during document capture, before this // same event reaches any bubble-phase `window` listener a host // surface owns) lets that listener check `event.defaultPrevented` // and know this keypress was already handled by the menu, rather // than racing a state update that may not have re-rendered yet // (AC-TASKS-TASK-ACTIONS-MENU-001.11). event.preventDefault(); onOpenChange(false); }} > ); }