Skip to content

fix(client): make the debug triple-tap gesture actually recognize three taps - #5189

Open
jeffrey701 wants to merge 1 commit into
phase-rs:mainfrom
jeffrey701:fix/triple-tap-debug-gesture
Open

fix(client): make the debug triple-tap gesture actually recognize three taps#5189
jeffrey701 wants to merge 1 commit into
phase-rs:mainfrom
jeffrey701:fix/triple-tap-debug-gesture

Conversation

@jeffrey701

Copy link
Copy Markdown
Contributor

Problem

useKeyboardShortcuts (client/src/hooks/useKeyboardShortcuts.ts) registers a touch gesture documented as "Triple-tap (touch): Toggle debug panel (iPad/mobile)". The implementation is broken two ways:

if (e.touches.length !== REQUIRED_FINGERS) { tapCount = 0; return; }  // (1)
...
tapCount++;
if (tapCount >= 2) { tapCount = 0; toggleDebugPanel(); }              // (2)
  1. It can never accumulate. A 3-finger tap arrives as separate touchstart events — 1 finger, then 2, then 3 (fingers never land on the same millisecond). The guard resets tapCount to 0 on each of those leading 1- and 2-finger events, so after a full 3-finger tap tapCount is only ever 1. On real hardware the panel never opens.
  2. Wrong threshold. Even ignoring (1), it fires at tapCount >= 2 — a double-tap, not the documented triple-tap.

Fix

Extract a pure advanceTripleTap recognizer (client/src/hooks/tripleTap.ts): a touchstart that isn't exactly 3 fingers is ignored (not reset), only exact-3-finger touchstarts count, and the gesture completes on the third such tap within the 500ms window. The hook threads its state through the recognizer.

Tests

Adds tripleTap.test.ts: triggers only on the third 3-finger tap; the leading 1-/2-finger events of each tap don't reset progress (the real-hardware case); two taps don't trigger; an out-of-window tap restarts; state resets after a trigger. All five fail against the old logic (verified by swapping it back in) and pass with the recognizer.

Self-contained: only useKeyboardShortcuts.ts, a new pure recognizer, and its test; no engine/Rust/protocol changes.

Model: claude-opus-4-8

@jeffrey701
jeffrey701 requested a review from matthewevans as a code owner July 6, 2026 05:35
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

…ee taps

The touch gesture documented as 'Triple-tap: Toggle debug panel' fired at tapCount >= 2 (a double-tap), and — worse — reset tapCount to 0 on every touchstart whose e.touches.length !== 3. Because a 3-finger tap always arrives as separate 1-, 2-, then 3-finger touchstarts (fingers never land on the same millisecond), those intermediate events zeroed the counter, so it never climbed past 1 and the panel never opened on real hardware. Extract a pure, unit-tested recognizer that ignores (does not reset on) non-3-finger touchstarts and requires three 3-finger taps within the window.
@jeffrey701
jeffrey701 force-pushed the fix/triple-tap-debug-gesture branch from c497a7c to 8e1803e Compare July 6, 2026 12:06
@matthewevans matthewevans added the defer-fe Frontend/client/UI PR deferred to Matt's direct review label Jul 6, 2026
@matthewevans

Copy link
Copy Markdown
Member

Deferred by maintainer intake policy — not ignored.

This current head (8e1803eea18486eb18900013d3de5da943129922) was triaged as a frontend-only change (client/src/hooks/__tests__/tripleTap.test.ts, client/src/hooks/tripleTap.ts, client/src/hooks/useKeyboardShortcuts.ts) by jeffrey701. The local frontend-review allowlist does not include this author, so this route does not perform an implementation-diff review or approve the PR.

A maintainer must explicitly take this PR or add a local frontend-review exception before it can receive substantive review. The defer label is a routing marker only, not a verdict on the change.

2 similar comments
@matthewevans

Copy link
Copy Markdown
Member

Deferred by maintainer intake policy — not ignored.

This current head (8e1803eea18486eb18900013d3de5da943129922) was triaged as a frontend-only change (client/src/hooks/__tests__/tripleTap.test.ts, client/src/hooks/tripleTap.ts, client/src/hooks/useKeyboardShortcuts.ts) by jeffrey701. The local frontend-review allowlist does not include this author, so this route does not perform an implementation-diff review or approve the PR.

A maintainer must explicitly take this PR or add a local frontend-review exception before it can receive substantive review. The defer label is a routing marker only, not a verdict on the change.

@matthewevans

Copy link
Copy Markdown
Member

Deferred by maintainer intake policy — not ignored.

This current head (8e1803eea18486eb18900013d3de5da943129922) was triaged as a frontend-only change (client/src/hooks/__tests__/tripleTap.test.ts, client/src/hooks/tripleTap.ts, client/src/hooks/useKeyboardShortcuts.ts) by jeffrey701. The local frontend-review allowlist does not include this author, so this route does not perform an implementation-diff review or approve the PR.

A maintainer must explicitly take this PR or add a local frontend-review exception before it can receive substantive review. The defer label is a routing marker only, not a verdict on the change.

@matthewevans matthewevans self-assigned this Aug 1, 2026
@matthewevans matthewevans added the bug Bug fix label Aug 1, 2026
@matthewevans matthewevans removed their assignment Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix defer-fe Frontend/client/UI PR deferred to Matt's direct review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants