Skip to content

Fix voice input revert#233

Merged
imxade merged 3 commits into
AOSSIE-Org:mainfrom
Rozerxshashank:fix-voice-input-revert
Mar 3, 2026
Merged

Fix voice input revert#233
imxade merged 3 commits into
AOSSIE-Org:mainfrom
Rozerxshashank:fix-voice-input-revert

Conversation

@Rozerxshashank

@Rozerxshashank Rozerxshashank commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Description

This PR restores and improves the composition handling in the trackpad input flow. It addresses regressions in voice input behavior on mobile devices while maintaining the real-time typing experience where possible.

Functional Verification

  • Please check off the behaviors verified with this change.

Screen Mirror

  • Screen MIrror works.

Authentication

  • Connection doesn't work without a valid token.

Basic Gestures

  • One-finger tap: Verified as Left Click.

  • Two-finger tap: Verified as Right Click.

  • Click and drag: Verified selection behavior.

  • Pinch to zoom: Verified zoom functionality (if applicable).

Modes & Settings

  • Cursor mode: Cursor moves smoothly and accurately.

  • Scroll mode: Page scrolls as expected.

  • Sensitivity: Verified changes in cursor speed/sensitivity settings.

  • Copy and Paste: Verified both Copy and Paste functionality.

  • Invert Scrolling: Verified scroll direction toggles correctly.

Advanced Input

  • Key combinations: Verified "hold" behavior for modifiers (e.g., Ctrl+C) and held keys are shown in buffer.

  • Keyboard input: Verified Space, Backspace, and Enter keys work correctly.

  • Glide typing: Verified path drawing and text output.

  • Voice input: Verified speech-to-text functionality for full sentences.

  • Backspace doesn't send the previous input.

Any other gesture or input behavior introduced:

  • New Gestures: Verified any other gesture or input behavior introduced in this PR.

Additional Notes:

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.

  • My code follows the project's code style and conventions

  • I have performed a self-review of my own code

  • I have commented my code, particularly in hard-to-understand areas

  • If applicable, I have made corresponding changes or additions to the documentation

  • If applicable, I have made corresponding changes or additions to tests

  • My changes generate no new warnings or errors

  • I have joined the and I will share a link to this PR with the project maintainers there

  • I have read the

  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.

  • Incase of UI change I've added a demo video.

Summary by CodeRabbit

  • New Features

    • Added preview copy/paste handlers to improve remote clipboard interactions
  • Bug Fixes

    • Improved IME composition handling to avoid sending intermediate composition text
    • Enhanced focus behavior to refocus input on blur when the keyboard is open
    • More reliable handling of modifiers, spaces and special key input during composition

…ile-input-realtime"

This reverts commit 42378f9, reversing
changes made to 01daf42.
This revert restores the isComposingRef logic and handles composition end events to ensure text is correctly sent from a hidden input, fixing regressions in voice input behavior on mobile devices.
@coderabbitai

coderabbitai Bot commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds IME composition awareness to the trackpad hidden input: tracks composition state, wires compositionstart/compositionend events to derive and send final text (or apply modifier behavior), suppresses intermediate composition text, and refocuses the hidden input on blur when keyboard is open.

Changes

Cohort / File(s) Summary
IME Composition & Input Enhancement
src/routes/trackpad.tsx
Introduced isComposingRef and composition event handlers (handleCompositionStart, handleCompositionEnd) on the hidden input; suppresses intermediate composition input, derives/sends final composed text (or applies modifier logic) on composition end; added copy/paste passthrough handlers, onBlur focus fallback, and hidden-input reset behavior after sends/keys.

Sequence Diagram(s)

sequenceDiagram
participant User
participant TrackpadComponent
participant HiddenInput
participant RemoteSender

User->>HiddenInput: start composition (IME)
HiddenInput->>TrackpadComponent: onCompositionStart -> set isComposingRef(true)
User->>HiddenInput: type composing characters (intermediate)
HiddenInput->>TrackpadComponent: onInput (ignored while composing)
User->>HiddenInput: end composition (commit text)
HiddenInput->>TrackpadComponent: onCompositionEnd -> get final text, reset hidden input
TrackpadComponent->>RemoteSender: sendText or applyModifierCommand(final text)
TrackpadComponent->>HiddenInput: refocus onBlur (if keyboard open) after timeout
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Typescript Lang

Poem

🐰
Tip-tap I hop on keys so fleet,
Composing words till they're complete.
Hidden input hums, then sends with cheer—
A rabbit's nibble, crystal clear.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix voice input revert' directly addresses the main objective of restoring voice input behavior and composition handling, which aligns with the primary change in the trackpad input flow.
Description check ✅ Passed The PR description includes a clear summary of changes, comprehensive functional verification with all advanced input behaviors checked, and a completed checklist. However, it is missing the 'Addressed Issues' section linking to a specific issue number as required by the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/trackpad.tsx`:
- Around line 85-90: Remove the raw console.log that prints live input payloads
(the console.log("Input Event:", { inputType, data, val, isComposing:
isComposingRef.current })) and any similar logs that print sensitive values
(also at the other noted locations), and replace them with either no-op in
production or a dev-only sanitized log: guard logging with a dev check (e.g.,
NODE_ENV or a debug flag) and redact actual text fields (show masked value,
length, or type only) while still preserving contextual keys like inputType and
isComposingRef.current for debugging; update all occurrences that log variables
named inputType, data, val, or isComposingRef to follow this pattern.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c56e381 and 54105b5.

📒 Files selected for processing (1)
  • src/routes/trackpad.tsx

Comment thread src/routes/trackpad.tsx Outdated
Removed console.log statements that captured user input to comply with security guidelines and reduce overhead on the input path.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

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)

1-14: ⚠️ Potential issue | 🟡 Minor

Missing "use client" directive.

This component uses client-side React features (useState, useEffect, useRef, event handlers). Per NextJS guidelines, add the directive at the top of the file.

+"use client"
+
 import { BufferBar } from "@/components/Trackpad/Buffer"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routes/trackpad.tsx` around lines 1 - 14, Add the Next.js client
directive by inserting "use client" as the very first line of the file (before
any imports) so the TrackpadPage component and hooks (useState, useEffect,
useRef, useRemoteConnection, useTrackpadGesture) are treated as client-side;
ensure the directive appears above the existing imports (e.g., BufferBar,
ControlBar, TouchArea, ScreenMirror) so createFileRoute and the exported
Route/component work correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/trackpad.tsx`:
- Around line 75-77: handlePaste is marked async but doesn't await anything;
remove the unnecessary async keyword or implement clipboard reading. Fix by
either changing "const handlePaste = async () => { send({ type: 'paste' }) }" to
"const handlePaste = () => { send({ type: 'paste' }) }" or, if you intended to
read the clipboard, implement and await navigator.clipboard.readText() inside
handlePaste and include the text in the event (e.g., const text = await
navigator.clipboard.readText(); send({ type: 'paste', text })). Ensure you
update any callers expecting a promise accordingly.
- Around line 281-285: The onBlur handler schedules a setTimeout to focus
hiddenInputRef which can run after unmount or after keyboardOpen changed; fix by
storing the timeout id in a ref (e.g., focusTimeoutRef), clear that timeout in a
useEffect cleanup (and on subsequent onBlur calls), and inside the timeout
callback guard that the component is still mounted and hiddenInputRef.current
exists and keyboardOpen is still true before calling focus; update the onBlur
that uses keyboardOpen, setTimeout, and hiddenInputRef accordingly and add the
cleanup logic in the component hook.

---

Outside diff comments:
In `@src/routes/trackpad.tsx`:
- Around line 1-14: Add the Next.js client directive by inserting "use client"
as the very first line of the file (before any imports) so the TrackpadPage
component and hooks (useState, useEffect, useRef, useRemoteConnection,
useTrackpadGesture) are treated as client-side; ensure the directive appears
above the existing imports (e.g., BufferBar, ControlBar, TouchArea,
ScreenMirror) so createFileRoute and the exported Route/component work
correctly.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54105b5 and 578104f.

📒 Files selected for processing (1)
  • src/routes/trackpad.tsx

Comment thread src/routes/trackpad.tsx
Comment thread src/routes/trackpad.tsx
@imxade
imxade merged commit bfb983f into AOSSIE-Org:main Mar 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants