Skip to content

⭐️⭐️⭐️ 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.

fix(web): open the issue a click asks for instead of closing the panel (#301)

Ahmad Othman Ammar Adic4b5b6125230
diff --git a/apps/web/src/components/layout/Shell.tsx b/apps/web/src/components/layout/Shell.tsx
index 3ae99314..cf4e1c88 100644
--- a/apps/web/src/components/layout/Shell.tsx
+++ b/apps/web/src/components/layout/Shell.tsx
@@ -124,7 +124,9 @@ export default function Shell({
return;
}
}
- overlays.setOpenIssueId(id);
+ // The issue the panel already shows closes it, so the card that opened the panel
+ // is the one that puts it away.
+ overlays.setOpenIssueId((current) => (current === id ? null : id));
};
const context: ShellContext = {
diff --git a/apps/web/src/features/issue/hooks/useExitOnClickOutside.ts b/apps/web/src/features/issue/hooks/useExitOnClickOutside.ts
index 46439a67..a520af7d 100644
--- a/apps/web/src/features/issue/hooks/useExitOnClickOutside.ts
+++ b/apps/web/src/features/issue/hooks/useExitOnClickOutside.ts
@@ -30,7 +30,10 @@ export function useExitOnClickOutside(ref: RefObject<HTMLElement | null>, onExit
// synthetic click) is judged on its own target rather than on the last press.
const pressed = pressedInside;
pressedInside = false;
- if (pressed) return;
+ // A click already handled by what it landed on is left alone, the same way
+ // useExitOnEscape leaves a handled key, so opening another issue from the page
+ // behind replaces what the panel shows rather than closing it.
+ if (pressed || e.defaultPrevented) return;
const surface = ref.current;
if (!surface || !(e.target instanceof Element)) return;
if (surface.contains(e.target)) return;
diff --git a/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsx b/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsx
index 0890d694..68385dc3 100644
--- a/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsx
+++ b/apps/web/src/features/work-items/components/calendar/CalendarDayChip.tsx
@@ -37,6 +37,7 @@ export function CalendarDayChip({
{...listeners}
onClick={(e) => {
e.stopPropagation();
+ e.preventDefault();
onOpen(issue.id);
}}
className={cn(
diff --git a/apps/web/src/features/work-items/components/calendar/CalendarDayOverflow.tsx b/apps/web/src/features/work-items/components/calendar/CalendarDayOverflow.tsx
index 8e3bbf00..b2b096b7 100644
--- a/apps/web/src/features/work-items/components/calendar/CalendarDayOverflow.tsx
+++ b/apps/web/src/features/work-items/components/calendar/CalendarDayOverflow.tsx
@@ -39,7 +39,8 @@ export function CalendarDayOverflow({
<TooltipTrigger asChild>
<button
type="button"
- onClick={() => {
+ onClick={(e) => {
+ e.preventDefault();
setOpen(false);
onOpen(issue.id);
}}
diff --git a/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsx b/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsx
index 5ec48707..3e5b58e1 100644
--- a/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsx
+++ b/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledCard.tsx
@@ -31,7 +31,10 @@ export function CalendarUnscheduledCard({
ref={setNodeRef}
{...attributes}
{...listeners}
- onClick={() => onOpen(issue.id)}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(issue.id);
+ }}
className={cn(
'kanban-card flex cursor-pointer items-center gap-2 rounded-md p-2 text-xs sm:touch-none',
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.tsx
index b32b9970..3810e20d 100644
--- a/apps/web/src/features/work-items/components/kanban/BoardCard.tsx
+++ b/apps/web/src/features/work-items/components/kanban/BoardCard.tsx
@@ -84,6 +84,9 @@ export function BoardCard({
e.stopPropagation();
selection.toggle(issue.id);
} else {
+ // Opening an issue handles the click, so the detail panel keeps it
+ // rather than reading it as a click outside and closing.
+ e.preventDefault();
onOpen(issue.id);
}
}}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineBar.tsx b/apps/web/src/features/work-items/components/timeline/TimelineBar.tsx
index 27d9be15..9ba33ec5 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineBar.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineBar.tsx
@@ -42,7 +42,14 @@ export function TimelineBar({
const bar = (
<div
onPointerDown={readOnly ? undefined : (e) => onBeginDrag(e, issue, 'move')}
- onClick={readOnly ? () => onOpen(issue.id) : undefined}
+ onClick={
+ readOnly
+ ? (e) => {
+ e.preventDefault();
+ onOpen(issue.id);
+ }
+ : undefined
+ }
className={cn(
'group absolute top-1/2 z-10 flex h-6 -translate-y-1/2 items-center rounded px-1.5 text-white select-none',
cursor,
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx b/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx
index b85ed22f..966afd7b 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineIssueRow.tsx
@@ -75,7 +75,10 @@ export function TimelineIssueRow({
readOnly ? 'cursor-pointer' : 'cursor-grab',
)}
style={{ width: labelW }}
- onClick={() => onOpen(issue.id)}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(issue.id);
+ }}
>
<IssueIdentifier
issue={issue}
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx b/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx
index 1003b538..8b728499 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineLinkRows.tsx
@@ -61,7 +61,10 @@ export function TimelineLinkRows({
indented ? 'pl-13' : 'pl-9',
)}
style={{ width: labelW }}
- onClick={() => onOpen(link.issue.id)}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(link.issue.id);
+ }}
>
{/* Fixed width so the identifiers stay in one column when a row
leaves its relation unnamed. */}
@@ -77,7 +80,10 @@ export function TimelineLinkRows({
/>
)}
<div
- onClick={() => onOpen(link.issue.id)}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(link.issue.id);
+ }}
className="absolute top-1/2 z-10 flex h-4 -translate-y-1/2 cursor-pointer items-center rounded px-1.5 text-white opacity-60"
style={{
left: rect.left,
diff --git a/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx b/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx
index 5f014a9b..288af452 100644
--- a/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx
+++ b/apps/web/src/features/work-items/components/timeline/TimelineSubtaskRows.tsx
@@ -62,7 +62,10 @@ export function TimelineSubtaskRows({
indented ? 'pl-10' : 'pl-6',
)}
style={{ width: labelW }}
- onClick={() => onOpen(subtask.id)}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(subtask.id);
+ }}
>
{/* Marks the row as nested under the issue row above: the sub-rows
are otherwise only indented, which reads as a link row. */}
@@ -84,7 +87,10 @@ export function TimelineSubtaskRows({
<Tooltip>
<TooltipTrigger asChild>
<div
- onClick={() => onOpen(subtask.id)}
+ onClick={(e) => {
+ e.preventDefault();
+ onOpen(subtask.id);
+ }}
className="absolute top-1/2 z-10 flex h-3.5 -translate-y-1/2 cursor-pointer items-center rounded-sm px-1.5 text-white opacity-80"
style={{
left: rect.left,