Skip to content

fix(mobile): keep keyboard out of model picker - #5686

Merged
t3dotgg merged 1 commit into
t3code/mobile-model-picker-flowsfrom
t3code/mobile-model-picker-keyboard-lifecycle
Aug 8, 2026
Merged

fix(mobile): keep keyboard out of model picker#5686
t3dotgg merged 1 commit into
t3code/mobile-model-picker-flowsfrom
t3code/mobile-model-picker-keyboard-lifecycle

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Aug 8, 2026

Copy link
Copy Markdown
Member

The model settings sheet could race the custom native composer. The keyboard could survive underneath the picker, delayed new-task autofocus could land after presentation started, and Save could refocus before the modal finished dismissing. Re-tapping a staged model could also discard its edited provider options.

The picker now uses one shared presentation lifecycle that latches opening synchronously, explicitly blurs the native editor, waits for keyboard dismissal before presenting, and restores focus only after modal dismissal. Re-tapping the highlighted staged model preserves its pending options.

Stacked on #5625.

Tests:

  • vp lint on the six touched mobile files
  • vp test run apps/mobile/src/features/threads/thread-settings-sheet-state.test.ts apps/mobile/src/lib/modelOptions.test.ts apps/mobile/src/lib/providerOptions.test.ts
  • vp run --filter @t3tools/mobile typecheck

Built by GPT-5.6 Sol using the Codex harness in T3 Code.


Note

Medium Risk
Changes focus/keyboard timing for the main composer and model picker on iOS and Android; behavior is localized to mobile UI but easy to regress in edge cases (autofocus, Save vs dismiss).

Overview
Fixes keyboard and focus races between the custom native composer and the thread settings / model picker modal on mobile.

Thread settings presentation is centralized in useThreadSettingsSheetPresentation, used by both ThreadComposer and NewTaskDraftScreen instead of duplicated local state. Opening latches active immediately (so the composer stays expanded), blurs the native editor, and waits for KeyboardController.dismiss() before the modal becomes visible. Closing moves through a closing phase; keyboard/focus is restored only after ThreadSettingsSheet reports dismissal via new onDismissed (iOS Modal.onDismiss, Android when visible goes false with no exit animation). Save restores focus only if the keyboard was up when the sheet opened; dismiss does not.

NewTaskDraftScreen delayed autofocus respects an active sheet via isActiveRef and can call restoreFocusAfterSave so Save still brings the keyboard back after a queued focus.

Model staging: re-tapping the already-highlighted staged model no longer resets pending provider options—logic extracted to pendingModelAfterPress with unit tests.

Reviewed by Cursor Bugbot for commit e132c95. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix keyboard interference with model picker in thread settings sheet

  • Introduces useThreadSettingsSheetPresentation to manage modal presentation phases (closed/opening/visible/closing), ensuring the keyboard fully dismisses before the settings modal appears.
  • Prevents the editor from stealing focus while the settings sheet is active, and restores focus only after the modal fully dismisses when closed via Save.
  • Adds pendingModelAfterPress to fix model selection staging: re-tapping the highlighted model preserves staged options, while tapping the already-applied model clears staging.
  • The composer remains visually expanded while the settings modal is opening or closing.
  • Behavioral Change: Android settings modal now uses no animation; iOS retains a fade animation.

Macroscope summarized e132c95.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

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: f7928524-08d3-4e0d-b34d-de8eada39084

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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 11.3 KiB 15.1 KiB
Codex Thread snapshot wire 5.5 KiB 7.3 KiB
Codex Live turn WebSocket wire 5.9 KiB 7.8 KiB
Codex Live turn WebSocket decoded 49.7 KiB 66.4 KiB
Codex Live turn messages 16 21
Claude Total thread wire 11.3 KiB 15.1 KiB
Claude Thread snapshot wire 5.5 KiB 7.3 KiB
Claude Live turn WebSocket wire 5.9 KiB 7.8 KiB
Claude Live turn WebSocket decoded 50.6 KiB 66.4 KiB
Claude Live turn messages 16 21

Baseline: unavailable · PR result: e132c95 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 94.6 KiB
  • Claude decoded thread snapshot: 95.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@macroscopeapp

macroscopeapp Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved e132c95

This PR extracts duplicated keyboard/modal focus coordination logic into a shared hook with proper phase-based state management. The changes are self-contained to mobile UI, include unit tests, and the author has recent history with these files.

You can customize Macroscope's approvability policy. Learn more.

@t3dotgg
t3dotgg merged commit a056b34 into t3code/mobile-model-picker-flows Aug 8, 2026
17 checks passed
@t3dotgg
t3dotgg deleted the t3code/mobile-model-picker-keyboard-lifecycle branch August 8, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant