⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
fix(web): scroll lists on touch instead of dragging cards on tablets (#464)
Ilija Matoski91a30b2bb520
diff --git a/apps/web/src/components/layout/TableProperties.tsx b/apps/web/src/components/layout/TableProperties.tsxindex 251ab01b..c70f7d9b 100644--- a/apps/web/src/components/layout/TableProperties.tsx+++ b/apps/web/src/components/layout/TableProperties.tsx@@ -5,7 +5,7 @@ import { useTranslations } from 'next-intl';import { byKey } from '@/utils/messageKey';import type { CustomField } from '@/lib/api/endpoints/customFields';import type { IssueType } from '@/lib/api/endpoints/issueTypes';-import { useStripSortSensors } from '@/lib/dnd';+import { useDndSensors } from '@/lib/dnd';import {DISPLAY_PROPERTIES,customFieldId,@@ -39,7 +39,7 @@ export default function TableProperties({trailing?: ReactNode;}) {const t = byKey(useTranslations('display.properties'));- const sensors = useStripSortSensors();+ const sensors = useDndSensors();const fieldById = new Map(customFields.map((f) => [f.id, f]));const builtins = new Set<PropertyKey>(DISPLAY_PROPERTIES);const labelFor = (key: PropertyKey): string | null => {diff --git a/apps/web/src/components/layout/ViewTabs.tsx b/apps/web/src/components/layout/ViewTabs.tsxindex b896a47e..59d126a5 100644--- a/apps/web/src/components/layout/ViewTabs.tsx+++ b/apps/web/src/components/layout/ViewTabs.tsx@@ -10,7 +10,7 @@ import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortablimport { Filter, Plus } from 'lucide-react';import { useTranslations } from 'next-intl';import type { View } from '@/lib/api/endpoints/views';-import { useStripSortSensors } from '@/lib/dnd';+import { useDndSensors } from '@/lib/dnd';import { usePermissions } from '@/hooks/usePermissions';import AllViewTab, { ALL_DROP_ID } from '@/components/layout/AllViewTab';import MobileViewSwitcher from '@/components/layout/MobileViewSwitcher';@@ -52,7 +52,7 @@ export default function ViewTabs({const canCreateView = can('views', 'create');const canEditView = can('views', 'edit');const canDeleteView = can('views', 'delete');- const sensors = useStripSortSensors();+ const sensors = useDndSensors();// The view being dragged, used to render the DragOverlay preview.const [activeId, setActiveId] = useState<number | null>(null);const activeView = activeId != null ? (views.find((v) => v.id === activeId) ?? null) : null;diff --git a/apps/web/src/features/ai-chat/components/panel/ChatPanelTabs.tsx b/apps/web/src/features/ai-chat/components/panel/ChatPanelTabs.tsxindex ab26fcfb..3e611332 100644--- a/apps/web/src/features/ai-chat/components/panel/ChatPanelTabs.tsx+++ b/apps/web/src/features/ai-chat/components/panel/ChatPanelTabs.tsx@@ -4,7 +4,7 @@ import { closestCenter, DndContext, type DragEndEvent } from '@dnd-kit/core';import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable';import { Plus } from 'lucide-react';import { useTranslations } from 'next-intl';-import { useStripSortSensors } from '@/lib/dnd';+import { useDndSensors } from '@/lib/dnd';import { Button } from '@/components/ui/button';import { ChatPanelTab } from './ChatPanelTab';import { ChatPanelTabFavorite } from './ChatPanelTabFavorite';@@ -35,7 +35,7 @@ export function ChatPanelTabs({onSwapTabs: (id: string, otherId: string) => void;}) {const t = useTranslations('aiChat');- const sensors = useStripSortSensors();+ const sensors = useDndSensors();const { rowRef, measureRef, visible, hidden } = useTabOverflow(sessions, activeId);const lastVisibleId = visible[visible.length - 1]?.id ?? null;const active = sessions.find((session) => session.id === activeId);diff --git a/apps/web/src/features/dashboards/components/DashboardTabs.tsx b/apps/web/src/features/dashboards/components/DashboardTabs.tsxindex e4b798b3..bb4b1cf0 100644--- a/apps/web/src/features/dashboards/components/DashboardTabs.tsx+++ b/apps/web/src/features/dashboards/components/DashboardTabs.tsx@@ -10,7 +10,7 @@ import { SortableContext, horizontalListSortingStrategy } from '@dnd-kit/sortablimport { LayoutDashboard, Plus } from 'lucide-react';import { useTranslations } from 'next-intl';import type { Dashboard } from '@/lib/api/endpoints/dashboards';-import { useStripSortSensors } from '@/lib/dnd';+import { useDndSensors } from '@/lib/dnd';import { usePermissions } from '@/hooks/usePermissions';import { cn } from '@/lib/utils';import DashboardTab from './DashboardTab';@@ -45,7 +45,7 @@ export default function DashboardTabs({const canCreate = can('dashboards', 'create');const canEdit = can('dashboards', 'edit');const canDelete = can('dashboards', 'delete');- const sensors = useStripSortSensors();+ const sensors = useDndSensors();const [activeId, setActiveId] = useState<number | null>(null);const dragged = activeId != null ? dashboards.find((d) => d.id === activeId) : null;// Name dialog state: 'new' to create, a dashboard to rename, or null (closed).diff --git a/apps/web/src/features/initiatives/InitiativesPage.tsx b/apps/web/src/features/initiatives/InitiativesPage.tsxindex 7a087f53..dd8ba1b3 100644--- a/apps/web/src/features/initiatives/InitiativesPage.tsx+++ b/apps/web/src/features/initiatives/InitiativesPage.tsx@@ -10,7 +10,7 @@ import { useShell } from '@/context/shellContext';import { usePermissions } from '@/hooks/usePermissions';import { useInitiativeCountsQuery, useInitiativesQuery } from '@/services/initiatives.service';import { INITIATIVE_SORTS, type InitiativeSort } from '@/lib/api/endpoints/initiatives';-import { useStripSortSensors } from '@/lib/dnd';+import { useDndSensors } from '@/lib/dnd';import { initiativesTabPath, type InitiativesTab } from '@/utils/paths';import { Button } from '@/components/ui/button';import { Tabs, TabsList } from '@/components/ui/tabs';@@ -37,7 +37,7 @@ export default function InitiativesPage({ tab }: { tab: InitiativesTab }) {const searchParams = useSearchParams();const [creating, setCreating] = useState(false);const { order, reorder } = useInitiativeTabOrder();- const sensors = useStripSortSensors();+ const sensors = useDndSensors();const projectKey = project?.project.ref ?? null;const activeTab = INITIATIVE_TABS.find((item) => item.value === tab)!;diff --git a/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsx b/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsxindex acd6507c..47c8b5d5 100644--- a/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsx+++ b/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsx@@ -20,8 +20,7 @@ export function CalendarDayChip({color: string;onOpen: (id: number) => void;}) {- // Drag is disabled on phones so a touch scrolls instead of picking up the issue- // (see the `sm:touch-none` below), and without work_items edit (rescheduling a+ // Drag is disabled on phones, and without work_items edit (rescheduling an// issue is an issue edit).const { can } = usePermissions();const { attributes, listeners, setNodeRef, isDragging } = useDraggable({@@ -42,7 +41,7 @@ export function CalendarDayChip({onOpen(issue.id);}}className={cn(- 'flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 text-xs transition-colors hover:bg-accent sm:touch-none',+ 'flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 text-xs transition-colors hover:bg-accent',isDragging && 'opacity-40',)}>diff --git a/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsx b/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsxindex 02fc76fa..ac425f1c 100644--- a/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsx+++ b/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsx@@ -18,9 +18,8 @@ export function CalendarUnscheduledCard({color: string;onOpen: (id: number) => void;}) {- // Drag is disabled on phones so a touch scrolls instead of picking up the issue- // (see the `sm:touch-none` below), and without work_items edit (scheduling a- // issue by dropping it on a day is an issue edit).+ // Drag is disabled on phones, and without work_items edit (scheduling an issue+ // by dropping it on a day is an issue edit).const { can } = usePermissions();const { attributes, listeners, setNodeRef, isDragging } = useDraggable({id: issue.id,@@ -37,7 +36,7 @@ export function CalendarUnscheduledCard({onOpen(issue.id);}}className={cn(- 'kanban-card flex cursor-pointer items-center gap-2 rounded-md p-2 text-xs sm:touch-none',+ 'kanban-card flex cursor-pointer items-center gap-2 rounded-md p-2 text-xs',isDragging && 'opacity-40',)}>diff --git a/apps/web/src/features/work-items/components/kanban/BoardCard.tsx b/apps/web/src/features/work-items/components/kanban/BoardCard.tsxindex 73bcdc13..b564b9b9 100644--- a/apps/web/src/features/work-items/components/kanban/BoardCard.tsx+++ b/apps/web/src/features/work-items/components/kanban/BoardCard.tsx@@ -35,9 +35,8 @@ export function BoardCard({// In a read-only share a click always opens the issue; multi-select is off.readOnly?: boolean;}) {- // Drag is disabled on phones so a touch scrolls the board instead of picking- // up a card (see the `sm:touch-none` on the card below), and without work_items- // edit (moving a card is an issue edit).+ // Drag is disabled on phones, and without work_items edit (moving a card is an+ // issue edit).const { can } = usePermissions();const selection = useSelection();const selected = selection.isSelected(issue.id);@@ -70,7 +69,6 @@ export function BoardCard({{...listeners}onPointerDown={(e) => {pressedAt.current = { x: e.clientX, y: e.clientY };- listeners?.onPointerDown?.(e);}}onClick={(e) => {// Both stopPropagation calls keep the click off the board background,@@ -94,7 +92,7 @@ export function BoardCard({className={cn(// select-none so a Shift/Cmd-click toggles selection without the browser// also starting a native text selection across cards.- 'kanban-card cursor-grab rounded-md p-2 select-none sm:touch-none',+ 'kanban-card cursor-grab rounded-md p-2 select-none',isDragging && 'opacity-40',isBlocked(issue) && 'kanban-card-blocked',// Selected cards read as a primary-tinted fill, like Linear — no border,diff --git a/apps/web/src/features/work-items/components/kanban/IssueCardLinks.tsx b/apps/web/src/features/work-items/components/kanban/IssueCardLinks.tsxindex 579efb7a..3a0d801b 100644--- a/apps/web/src/features/work-items/components/kanban/IssueCardLinks.tsx+++ b/apps/web/src/features/work-items/components/kanban/IssueCardLinks.tsx@@ -1,5 +1,6 @@import type { IssueLinkRef } from '@/lib/api/endpoints/issues';import { type Maps } from '@/utils/project';+import { noDragProps } from '@/lib/dnd';import { cn } from '@/lib/utils';import { LINK_RELATION_ICONS } from '@/utils/issueLinks';import { useLinkRelationLabel } from '@/hooks/useLinkRelationLabel';@@ -46,9 +47,9 @@ export function IssueCardLinks({<TooltipTrigger asChild><buttontype="button"- // The card below starts a drag on pointerdown and opens itself- // on click; a link row must do neither.- onPointerDown={(e) => e.stopPropagation()}+ // The card below starts a drag on press and opens itself on+ // click; a link row must do neither.+ {...noDragProps}onClick={(e) => {e.stopPropagation();e.preventDefault();diff --git a/apps/web/src/features/work-items/components/kanban/IssueCardSubtasks.tsx b/apps/web/src/features/work-items/components/kanban/IssueCardSubtasks.tsxindex f2184275..11f711cc 100644--- a/apps/web/src/features/work-items/components/kanban/IssueCardSubtasks.tsx+++ b/apps/web/src/features/work-items/components/kanban/IssueCardSubtasks.tsx@@ -3,6 +3,7 @@ import { ChevronDown, ChevronRight, ListTree } from 'lucide-react';import { useTranslations } from 'next-intl';import { type Maps } from '@/utils/project';import { subtaskProgress } from '@/utils/subtasks';+import { noDragProps } from '@/lib/dnd';import { cn } from '@/lib/utils';import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';import { StateIcon } from '@/features/issue/components/shared/IssueIcons';@@ -38,9 +39,9 @@ export function IssueCardSubtasks({<div className="mt-2.5 flex flex-col gap-1 border-t border-border/50 pt-2"><buttontype="button"- // The card starts a drag on pointerdown and opens itself on click, so the+ // The card starts a drag on press and opens itself on click, so the// header has to refuse both the way a subtask row does.- onPointerDown={(e) => e.stopPropagation()}+ {...noDragProps}onClick={(e) => {e.stopPropagation();e.preventDefault();@@ -68,9 +69,9 @@ export function IssueCardSubtasks({<TooltipTrigger asChild><buttontype="button"- // The card above starts a drag on pointerdown and opens itself- // on click; a subtask row must do neither.- onPointerDown={(e) => e.stopPropagation()}+ // The card above starts a drag on press and opens itself on+ // click; a subtask row must do neither.+ {...noDragProps}onClick={(e) => {e.stopPropagation();e.preventDefault();diff --git a/apps/web/src/features/work-items/components/shared/IssueIdentifier.tsx b/apps/web/src/features/work-items/components/shared/IssueIdentifier.tsxindex f9bff632..f9a2f51d 100644--- a/apps/web/src/features/work-items/components/shared/IssueIdentifier.tsx+++ b/apps/web/src/features/work-items/components/shared/IssueIdentifier.tsx@@ -1,5 +1,6 @@import { ChevronRight } from 'lucide-react';import type { Issue } from '@/lib/api/endpoints/issues';+import { noDragProps } from '@/lib/dnd';import { cn } from '@/lib/utils';import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';import { useParentIssue } from '../../context/useSubtasks';@@ -27,9 +28,9 @@ export function IssueIdentifier({<TooltipTrigger asChild><buttontype="button"- // The card and the row start a drag on pointerdown and open- // themselves on click; the parent link must do neither.- onPointerDown={(e) => e.stopPropagation()}+ // The card and the row start a drag on press and open themselves+ // on click; the parent link must do neither.+ {...noDragProps}onClick={(e) => {e.stopPropagation();e.preventDefault();diff --git a/apps/web/src/features/work-items/components/table/TableRow.tsx b/apps/web/src/features/work-items/components/table/TableRow.tsxindex 2b6b9647..e5825211 100644--- a/apps/web/src/features/work-items/components/table/TableRow.tsx+++ b/apps/web/src/features/work-items/components/table/TableRow.tsx@@ -53,9 +53,8 @@ export function TableRow({// Opens a linked issue from a sub-row.onOpenIssue: (id: number) => void;}) {- // Drag is disabled on phones so a touch scrolls the list instead of picking up- // a row (see the `sm:touch-none` below), and without work_items edit (reordering- // is an issue edit).+ // Drag is disabled on phones, and without work_items edit (reordering is an+ // issue edit).const { can } = usePermissions();const subtasks = useSubtaskFold();const {@@ -91,7 +90,7 @@ export function TableRow({onClick();}}className={cn(- 'relative grid cursor-grab gap-3 border-b py-2 pr-4 text-sm transition-colors sm:touch-none',+ 'relative grid cursor-grab gap-3 border-b py-2 pr-4 text-sm transition-colors',isBlocked(issue) ? 'row-blocked' : 'hover:bg-accent/40',alignTop ? 'items-start' : 'items-center',indented ? 'pl-9' : 'pl-4',diff --git a/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx b/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsxindex d96dbdcc..a46f94bc 100644--- a/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx+++ b/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx@@ -53,8 +53,6 @@ export function TimelineIssueRow({onBeginDrag: (e: React.PointerEvent, issue: Issue, mode: TimelineDragMode) => void;onOpen: (id: number) => void;}) {- // Drag is disabled on phones so a touch scrolls the timeline instead of picking- // up a row (see the `sm:touch-none` below).const isPhone = useIsPhone();const fold = useIssueSubtaskFold();const { setNodeRef, attributes, listeners, isDragging } = useDraggable({@@ -73,7 +71,7 @@ export function TimelineIssueRow({{...attributes}{...listeners}className={cn(- 'sticky left-0 z-10 flex shrink-0 items-center gap-2 overflow-hidden border-r bg-background pr-3 sm:touch-none',+ 'sticky left-0 z-10 flex shrink-0 items-center gap-2 overflow-hidden border-r bg-background pr-3',indented ? 'pl-7' : 'pl-3',readOnly ? 'cursor-pointer' : 'cursor-grab',)}diff --git a/apps/web/src/lib/dnd.ts b/apps/web/src/lib/dnd.tsindex b54ca01c..80a61705 100644--- a/apps/web/src/lib/dnd.ts+++ b/apps/web/src/lib/dnd.ts@@ -1,23 +1,17 @@-import {- KeyboardSensor,- MouseSensor,- PointerSensor,- TouchSensor,- useSensor,- useSensors,-} from '@dnd-kit/core';+import { KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors } from '@dnd-kit/core';import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';+import type { SyntheticEvent } from 'react';// How far the pointer must move before a press becomes a drag. Also the threshold// a draggable uses to tell a click apart from the click the browser fires after a// drag ends.export const DRAG_ACTIVATION_DISTANCE = 4;-// Shared drag sensors for every dnd-kit surface in the planner. The pointer-// sensor uses a small activation distance so a click on a draggable element-// still registers as a click (select a tab, open a issue) instead of starting-// a drag; the keyboard sensor adds accessible reordering. Drag is turned off on-// phones per-draggable via `useDraggable({ disabled })` (see useIsPhone), not by+// Shared drag sensors for every dnd-kit surface. A mouse drag starts after a+// small move, so a click on a draggable still registers as a click. A touch drag+// starts after a press-and-hold, so a swipe scrolls the list or strip under it;+// draggables must not set `touch-none` for that. Drag is turned off on phones+// per-draggable via `useDraggable({ disabled })` (see useIsPhone), not by// dropping sensors here — dnd-kit puts the sensors in a useEffect dependency// array and warns if its length changes between renders.//@@ -27,21 +21,21 @@ export const DRAG_ACTIVATION_DISTANCE = 4;// instance, so the sensor-array length still never changes between its renders.export function useDndSensors(inert = false) {const sensors = useSensors(- useSensor(PointerSensor, { activationConstraint: { distance: DRAG_ACTIVATION_DISTANCE } }),+ useSensor(MouseSensor, { activationConstraint: { distance: DRAG_ACTIVATION_DISTANCE } }),+ useSensor(TouchSensor, { activationConstraint: { delay: 250, tolerance: 8 } }),useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),);const inertSensors = useSensors();return inert ? inertSensors : sensors;}-// Sensors for a horizontally-scrollable sortable strip (the view tabs). Mouse-// drags start after a small move; touch requires a short press-and-hold, so a-// quick swipe scrolls the strip natively instead of starting a reorder. Pair-// this with NO `touch-none` on the items so native touch scrolling works.-export function useStripSortSensors() {- return useSensors(- useSensor(MouseSensor, { activationConstraint: { distance: DRAG_ACTIVATION_DISTANCE } }),- useSensor(TouchSensor, { activationConstraint: { delay: 250, tolerance: 8 } }),- useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),- );-}+const stopPropagation = (e: SyntheticEvent) => e.stopPropagation();++// Spread on a control inside a draggable so pressing it does not start a drag of+// the draggable. pointerdown is stopped too: a board card records where a press+// started on it.+export const noDragProps = {+ onMouseDown: stopPropagation,+ onTouchStart: stopPropagation,+ onPointerDown: stopPropagation,+};