⚡ 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): activate repeated rows with Space and clear both relation ends
Juan5f20ff381853
diff --git a/apps/web/src/components/list-view/task-row.test.tsx b/apps/web/src/components/list-view/task-row.test.tsxindex 1ad68a076..bfefdf710 100644--- a/apps/web/src/components/list-view/task-row.test.tsx+++ b/apps/web/src/components/list-view/task-row.test.tsx@@ -1,4 +1,4 @@-import { cleanup, render, screen } from "@testing-library/react";+import { cleanup, fireEvent, render, screen } from "@testing-library/react";import { afterEach, describe, expect, it, vi } from "vitest";import type Task from "@/types/task";import TaskRow from "./task-row";@@ -12,8 +12,10 @@ afterEach(() => {vi.clearAllMocks();});+const navigate = vi.fn();+vi.mock("@tanstack/react-router", () => ({- useNavigate: () => vi.fn(),+ useNavigate: () => navigate,}));vi.mock("@/hooks/queries/external-link/use-external-links", () => ({@@ -226,6 +228,23 @@ describe("TaskRow", () => {expect(row).toHaveAttribute("tabindex", "0");});+ it("opens a repeated row with Space as well as Enter", () => {+ render(+ <TaskRow task={task} projectSlug="kan" rowId="parent/task-1" depth={1} />,+ );++ const row = screen.getByRole("button", { name: /Row from payload/ });++ // The repeat carries button semantics but none of dnd-kit's keyboard+ // listeners, so Space has to be handled for it to activate like one.+ fireEvent.keyDown(row, { key: " " });+ expect(navigate).toHaveBeenCalled();++ navigate.mockClear();+ fireEvent.keyDown(row, { key: "Enter" });+ expect(navigate).toHaveBeenCalled();+ });+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 ce0cf7326..22e6c341d 100644--- a/apps/web/src/components/list-view/task-row.tsx+++ b/apps/web/src/components/list-view/task-row.tsx@@ -196,6 +196,18 @@ function TaskRow({const handleKeyDown = (e: React.KeyboardEvent) => {if (e.key === "Enter") {handleClick(e as unknown as React.MouseEvent);+ return;+ }++ // Space activates a control with button semantics. Only the repeats need+ // it handled here: the top-level rows hand Space to dnd-kit, which starts+ // a keyboard drag with it.+ if (isNestedRepeat && e.key === " ") {+ // Opened before the default is prevented: handleClick ignores an event+ // that is already defaultPrevented, and preventing it anywhere in this+ // handler still stops the page scrolling.+ handleClick(e as unknown as React.MouseEvent);+ e.preventDefault();}};diff --git a/apps/web/src/hooks/mutations/task-relation/use-delete-task-relation.ts b/apps/web/src/hooks/mutations/task-relation/use-delete-task-relation.tsindex 609126890..fda36bee2 100644--- a/apps/web/src/hooks/mutations/task-relation/use-delete-task-relation.ts+++ b/apps/web/src/hooks/mutations/task-relation/use-delete-task-relation.ts@@ -6,13 +6,22 @@ function useDeleteTaskRelation(taskId: string) {return useMutation({mutationFn: deleteTaskRelation,- onSuccess: () => {- queryClient.invalidateQueries({- queryKey: ["task-relations", taskId],- });- // Both the other end of the relation and the project-scoped query the- // list view reads are stale now, and neither is keyed by this task.- // Invalidating the prefix covers every project a mounted view holds.+ onSuccess: (deleted) => {+ // Both ends go stale, and only one of them is the task this hook was+ // opened for. Queries default to refetchOnMount: false, so opening the+ // other task would otherwise still list the relation.+ const endpoints = new Set([+ taskId,+ deleted.sourceTaskId,+ deleted.targetTaskId,+ ]);+ for (const endpoint of endpoints) {+ queryClient.invalidateQueries({+ queryKey: ["task-relations", endpoint],+ });+ }+ // The project-scoped query the list view reads is keyed by neither, and+ // the prefix covers every project a mounted view holds.queryClient.invalidateQueries({queryKey: ["task-relations", "project"],});