Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): recover keyboard composers after Android resume #8212

Closedmrmg(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/8212/headopened View on GitHub

Problem

On Android, task switching while the IME is dismissing can leave KeyboardStickyView with a stale animated height after resume, so the composer remains high on the screen after the keyboard closes.

Reproduction

Android keyboard composer remains elevated after task switching

Fix

Quarantine keyboard translation on Android resume and release it only after a fresh keyboard-show event or owned input focus. Apply the guard to the thread, new-task, terminal, and review sticky surfaces, with a pure lifecycle regression test.

Verification

  • vp test run apps/mobile/src/features/keyboard/androidKeyboardRecovery.test.ts apps/mobile/src/features/threads/pendingUserInputLayout.test.ts
  • vp run --filter @t3tools/mobile typecheck
  • Scoped vp fmt --check
  • Scoped vp lint --report-unused-disable-directives

Android emulator/device verification was not available in this environment.

Built with GPT-5.6-Luna in the Codex harness.


Note

Medium Risk Touches native terminal events and keyboard layout across several high-traffic Android screens; incorrect quarantine timing could briefly mis-position composers or sticky toolbars, but changes are scoped to Android keyboard recovery with iOS paths largely unchanged.

Overview Fixes Android composers and terminal chrome staying elevated after task-switching during IME dismiss by quarantining reliance on react-native-keyboard-controller visibility/height until the keyboard stream is known-good again.

Introduces a small recovery state machine (useAndroidKeyboardRecovery + helpers) that enters quarantined on app resume (and for Android surfaces mounted while already active) and returns to ready on keyboardWillShow or when an owned text field gains focus. Thread detail, new task, review comment composer, and the terminal route now gate KeyboardStickyView, bottom insets, and accessory visibility on isAndroidKeyboardAnimationUsable instead of raw keyboard visibility; thread detail drops its ad-hoc keyboardStateSuspect logic in favor of the shared hook.

Adds native onTerminalFocus on the T3 terminal view (iOS + Android) so focusing the hidden terminal EditText can release the quarantine; Android also emits focus when requestKeyboardFocus runs with retained focus and IME window insets show the keyboard is actually visible.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 370d8293fabbcab04e039103532bdaf0c72a295c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix stale keyboard composers after Android resume with recovery quarantine

  • Adds a shared Android keyboard-recovery state machine in androidKeyboardRecovery.ts and a useAndroidKeyboardRecovery hook that quarantines keyboard animation after app resume or active-state mounting, releasing on a fresh keyboard-show or owned-input-focus event
  • Adds a terminal-focus native event on both Android (T3TerminalView.kt) and iOS (T3TerminalView.swift), forwarded through NativeTerminalSurface.tsx, so terminal input focus can release the quarantine
  • Updates ThreadDetailScreen.tsx, NewTaskDraftScreen.tsx, ReviewCommentComposerSheet.tsx, and ThreadTerminalRouteScreen.tsx to gate sticky keyboard layouts and bottom insets on the shared usability predicate instead of raw keyboard visibility
  • Risk: the requestKeyboardFocus handler in T3TerminalView now checks window insets for IME visibility before dispatching focus; if insets are unavailable on a device, the focus event may not fire and the quarantine could persist until the next keyboard-show event
Macroscope summarized 370d829.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: bd0574a3-7ade-44d2-85f1-4337a11d9d40

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR introduces cross-cutting Android keyboard recovery state and native focus events, changing resume, inset, sticky-composer, and terminal behavior across several existing mobile workflows. Its native-to-JS lifecycle coordination is broader than a small self-contained fix and warrants human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 75b725800b4d76c081707d5fc647cae44301af2c. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. Note

      This comment is posted by Julius' dot

      Closing for missing verification evidence. The reproduction image shows the stuck composer, but there is no after screenshot or recording of task switching, resuming, and dismissing the keyboard. The description says Android device or emulator verification was unavailable, and the pure lifecycle test does not demonstrate native keyboard recovery. Add before/after captures and a short Android recording of those steps, with the device, build, and observed results, then request reconsideration.

    6. juliusmarminge closed this

Sign in to join this conversation.