Fix: Prevent backspace buffer re-emission in trackpad hidden input#106
Fix: Prevent backspace buffer re-emission in trackpad hidden input#106Rozerxshashank wants to merge 2 commits intoAOSSIE-Org:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThe PR enhances TrackpadPage's key event handling to fix a bug where backspace sends the previous buffered input. When backspace or enter keys are detected, the code now prevents default browser behavior and clears the hidden input value before sending the key event. Other multi-character keys maintain existing behavior with explicit braces added. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
61d12dc to
00dbe57
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/routes/trackpad.tsx (1)
105-110:⚠️ Potential issue | 🟡 MinorRemove debug
console.logstatements.Lines 106 and 110 contain development-time trace logs that should not ship to production. They leak internal state (modifier, buffer, combo keys) to the browser console.
🧹 Proposed fix
const handleModifier = (key: string) => { - console.log(`handleModifier called with key: ${key}, current modifier: ${modifier}, buffer:`, buffer); - if (modifier === "Hold") { const comboKeys = [...buffer, key]; - console.log(`Sending combo:`, comboKeys); sendCombo(comboKeys); return; } else if (modifier === "Active") {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/routes/trackpad.tsx` around lines 105 - 110, Remove the development console.log traces in handleModifier: delete the console.log that prints `handleModifier called with key: ${key}, current modifier: ${modifier}, buffer:` and the console.log that prints `Sending combo:` before sending comboKeys; keep the existing logic that builds comboKeys from buffer and key and the subsequent send/dispatch behavior intact so only the debug output is removed (refer to function handleModifier, variables modifier, buffer, and comboKeys).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/routes/trackpad.tsx`:
- Around line 105-110: Remove the development console.log traces in
handleModifier: delete the console.log that prints `handleModifier called with
key: ${key}, current modifier: ${modifier}, buffer:` and the console.log that
prints `Sending combo:` before sending comboKeys; keep the existing logic that
builds comboKeys from buffer and key and the subsequent send/dispatch behavior
intact so only the debug output is removed (refer to function handleModifier,
variables modifier, buffer, and comboKeys).
Addressed Issues:
Fixes #96
This PR the issue where pressing the backspace key on a mobile keyboard would sometimes cause the previously typed text/buffer to be re-sent to the server instead of just deleting characters.
This was caused by the browser's native predictive text logic interacting with our onChange handler.
###Verification
Manual Test: Typed strings (e.g., "organisation") and rapidly pressed backspace on a mobile device.
Result: Server logs confirmed only backspace key events were processed, and the previous buffer was not re-emitted.
Checklist
Summary by CodeRabbit