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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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