Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(todo): stop the press-scale animation from swallowing checkbox clicks (#2158)

Maurice354a89f25b8e
diff --git a/client/src/components/Planner/DayPlanSidebar.tsx b/client/src/components/Planner/DayPlanSidebar.tsx
index e77f19765..f564d3136 100644
--- a/client/src/components/Planner/DayPlanSidebar.tsx
+++ b/client/src/components/Planner/DayPlanSidebar.tsx
@@ -1627,6 +1627,9 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP
// own, hence the key handler only answers for the row — and it
// toggles exactly like the click, rather than only selecting.
role="button"
+ // No press-scale on the wide row — it would shift the nested
+ // buttons out from under the pointer mid-click (#2158).
+ data-no-press
tabIndex={0}
onClick={() => toggleDaySelection()}
onKeyDown={e => {
@@ -1953,8 +1956,10 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP
// Picking the place out of the day has no other trigger, so
// the row is the control. Its grip, lock and arrows are
// buttons in their own right, hence the key handler only
- // answers for the row itself.
+ // answers for the row itself. No press-scale — see the
+ // day header above (#2158).
role="button"
+ data-no-press
tabIndex={0}
draggable={canEditDays && !dragDisabled}
onDragStart={e => {
@@ -2336,7 +2341,9 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP
<div
// Opening the booking has no other trigger, so the row is
// the control; the buttons inside it answer for themselves.
+ // No press-scale — see the day header above (#2158).
role="button"
+ data-no-press
tabIndex={0}
onClick={openTransportRow}
onKeyDown={e => {
diff --git a/client/src/components/Planner/ReservationsPanel.tsx b/client/src/components/Planner/ReservationsPanel.tsx
index edddd24ed..13a77d74d 100644
--- a/client/src/components/Planner/ReservationsPanel.tsx
+++ b/client/src/components/Planner/ReservationsPanel.tsx
@@ -614,6 +614,9 @@ function TransitJourneyCard({ r, days, onOpen, onDelete, canEdit, tripId, contri
className="bg-surface-card"
onClick={() => onOpen(r)}
role="button"
+ // No press-scale on the card — it would shift the nested controls out
+ // from under the pointer mid-click (#2158).
+ data-no-press
tabIndex={0}
onKeyDown={e => { if (e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); onOpen(r) } }}
style={{ borderRadius: 12, border: '1px solid rgba(124,58,237,0.22)', padding: '12px 14px', display: 'flex', flexDirection: 'column', gap: 9, cursor: 'pointer', transition: 'box-shadow 0.15s ease' }}
diff --git a/client/src/components/Todo/TodoRow.test.tsx b/client/src/components/Todo/TodoRow.test.tsx
index ab686c882..7a9f7111c 100644
--- a/client/src/components/Todo/TodoRow.test.tsx
+++ b/client/src/components/Todo/TodoRow.test.tsx
@@ -1,4 +1,4 @@
-// FE-W4TDR-001 to FE-W4TDR-020
+// FE-W4TDR-001 to FE-W4TDR-022
import type { ComponentProps } from 'react'
import { describe, it, expect, vi } from 'vitest'
import type { TodoItem } from '../../types'
@@ -207,4 +207,25 @@ describe('TodoRow', () => {
)
expect((container.firstElementChild as HTMLElement).style.boxShadow).toBe('inset 3px 0 0 0 var(--accent)')
})
+
+ it('FE-W4TDR-021: the row opts out of the global press-scale (#2158)', () => {
+ // jsdom cannot replay the browser mechanics behind #2158: the :active
+ // scale on the row-wide role="button" shifted the checkbox out from under
+ // the pointer, so the click retargeted onto the row and opened the detail
+ // pane instead of toggling. The data-no-press attribute is the pin.
+ const { container } = setup(todo())
+
+ expect(container.firstElementChild).toHaveAttribute('data-no-press')
+ })
+
+ it('FE-W4TDR-022: the checkbox toggles without selecting or starting a drag', () => {
+ const drag = dragHandlers()
+ const { onToggle, onSelect, container } = setup(todo(), { drag })
+
+ fireEvent.click(container.querySelector('button')!)
+
+ expect(onToggle).toHaveBeenCalledWith(10, true)
+ expect(onSelect).not.toHaveBeenCalled()
+ expect(drag.onStart).not.toHaveBeenCalled()
+ })
})
diff --git a/client/src/components/Todo/TodoRow.tsx b/client/src/components/Todo/TodoRow.tsx
index f300eec9b..ada8d79cb 100644
--- a/client/src/components/Todo/TodoRow.tsx
+++ b/client/src/components/Todo/TodoRow.tsx
@@ -37,6 +37,10 @@ export default function TodoRow({ item, members, categories, today, isSelected,
// checkbox and its drag handle answer for themselves, hence the key handler
// only fires when the row itself has focus.
role="button"
+ // Opt out of the global :active press-scale: shrinking the row-wide button
+ // slides the checkbox out from under the pointer mid-click, so the click
+ // retargets onto the row and opens the detail pane instead (#2158).
+ data-no-press
tabIndex={0}
onClick={() => onSelect(isSelected ? null : item.id)}
onKeyDown={e => {