⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix(web): hold the subtree together during a drag
Juancd23893e7e61
diff --git a/apps/web/src/components/list-view/index.tsx b/apps/web/src/components/list-view/index.tsxindex c249e494c..b2764d7b1 100644--- a/apps/web/src/components/list-view/index.tsx+++ b/apps/web/src/components/list-view/index.tsx@@ -365,14 +365,13 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {tasks: column.tasks,children: subtaskChildren,tasksById,- isExpanded: (rowId) => {- if (!expandedTasks[rowId]) return false;- // activeId is the dragged row's id, which is a bare task id because- // only top-level rows drag. The same task can also be rendered at- // "parent/child", and those occurrences have to collapse too.- const taskId = rowId.slice(rowId.lastIndexOf("/") + 1);- return activeId !== taskId;- },+ // Nothing stays expanded while a drag is in flight. Nested repeats are+ // not in the SortableContext, so they never receive the transforms+ // applied to the top-level rows: dragging any task past an expanded+ // parent would slide the parent while its children stayed put, and the+ // subtree would visibly split. Collapsing happens once, as the drag+ // starts, rather than shifting rows under a moving pointer.+ isExpanded: (rowId) => !activeId && Boolean(expandedTasks[rowId]),});const groupHasSubtasks = rows.some(diff --git a/apps/web/src/components/list-view/task-row.test.tsx b/apps/web/src/components/list-view/task-row.test.tsxindex dd2117348..1ad68a076 100644--- a/apps/web/src/components/list-view/task-row.test.tsx+++ b/apps/web/src/components/list-view/task-row.test.tsx@@ -214,6 +214,18 @@ describe("TaskRow", () => {expect(interpolations).toContainEqual({ title: "Row from payload" });});+ it("does not announce a repeated row as disabled", () => {+ render(+ <TaskRow task={task} projectSlug="kan" rowId="parent/task-1" depth={1} />,+ );++ // The repeat is not a drag source, but it still opens its task, so the+ // aria-disabled dnd-kit puts on a disabled sortable must not reach it.+ const row = screen.getByRole("button", { name: /Row from payload/ });+ expect(row).not.toHaveAttribute("aria-disabled", "true");+ expect(row).toHaveAttribute("tabindex", "0");+ });+it("labels the toggle by its resulting state", () => {render(<TaskRowdiff --git a/apps/web/src/components/list-view/task-row.tsx b/apps/web/src/components/list-view/task-row.tsxindex 91f85397c..ce0cf7326 100644--- a/apps/web/src/components/list-view/task-row.tsx+++ b/apps/web/src/components/list-view/task-row.tsx@@ -276,13 +276,18 @@ function TaskRow({<divonClick={handleClick}onKeyDown={handleKeyDown}+ // A repeated row opens its task like any other, so it keeps the+ // button semantics but takes none of dnd-kit's attributes: those+ // carry aria-disabled for a disabled sortable, which would tell+ // assistive technology the row cannot be used.+ {...(isNestedRepeat+ ? { role: "button" as const, tabIndex: 0 }+ : { ...attributes, ...listeners })}className={cn("relative flex min-w-0 flex-1 items-center gap-3 py-1.5 pr-4 transition-colors cursor-pointer",showToggleColumn ? "pl-2" : "pl-4",isTaskSelected ? "bg-accent/45" : "group-hover:bg-accent/60",)}- {...attributes}- {...listeners}>{depth > 0 && (// The indent is decorative, so nesting is otherwise inaudible:diff --git a/apps/web/src/hooks/mutations/task/use-bulk-operations.ts b/apps/web/src/hooks/mutations/task/use-bulk-operations.tsindex b96cea296..f59edc6ac 100644--- a/apps/web/src/hooks/mutations/task/use-bulk-operations.ts+++ b/apps/web/src/hooks/mutations/task/use-bulk-operations.ts@@ -14,7 +14,13 @@ export function useBulkOperations() {mutationFn: async (taskIds: string[]) => {await Promise.all(taskIds.map((id) => deleteTask(id)));},- onSuccess: invalidateCommon,+ onSuccess: () => {+ invalidateCommon();+ // Relations cascade with each task, and the task-deleted broadcast skips+ // the window that issued the delete. Only this path refreshes the edge+ // set for whoever ran the bulk operation.+ queryClientRef.invalidateQueries({ queryKey: ["task-relations"] });+ },});const bulkArchive = useMutation({