Repository navigation
fix(mobile): Android terminal moves up with the keyboard instead of snapping - #35465
juliusmarminge wants to merge 3 commits into
Conversation
…napping AI-assisted; verified with the tests and tools listed above.
…nce per keyboard move AI-assisted; verified with the tests and tools listed above.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Android terminal layout and its accessory now follow keyboard motion, while PTY resize reports are deferred until the animation settles. The effects are limited to layout and resize timing, with no apparent material data or access risk. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…ard instead of the late JS state AI-assisted; verified with the tests and tools listed above.
Dismissing prior approval to re-evaluate 08b77a1
Both review items were checked against the code and are correct; both are fixed. (1) Accessory overlap: KeyboardStickyView translates the full 52pt accessory, so scaling its reservation by keyboard progress left 52*(1-p) points of overlap. The animated paddingBottom is now -keyboardHeight + (accessory visible ? 52 : 0), reserving the accessory's full height once it is shown, as main does. (2) Resize storm: the animated padding still changes the native view's size every frame. That is local work: T3TerminalView.applyGrid draws min(sharedGrid, measured fit), so the view shrinks and keeps the prompt visible without a server round trip. Only the report to the PTY is deferred: terminalKeyboardShowing.ts (which already listens to the keyboard events) gains runWhenKeyboardSettles(owner, run). It runs immediately when the keyboard is still, and otherwise keeps only the latest call per owner and runs it on keyboardDidShow/keyboardDidHide. On Android, handleResize sends terminalSessionDriver.reportGridSize through it (keyed by the driver); the grid-size cache and iOS are unchanged. Measured on a leased Pixel 9 (Gboard) with a bash WINCH trap logging tput lines: keyboard open delivered one SIGWINCH (29 rows), down from about 15-20 at the previous head. Close delivered two (55, then 50 once the Android 'Attach output' bar mounts after didHide). Main's close also steps twice by its code (the accessory leaves on willHide, then padding drops on didHide); I did not count on main. A frame-by-frame recording of the open shows the prompt just above the rising keyboard and no accessory overlap. No new regex or parser.
Fixes #14464
Reproduction on main
Commit f03db4f (origin/main). Ran a fresh isolated server (
node apps/server/src/bin.ts --no-browser --base-dir <scratch> --host 0.0.0.0 --auto-bootstrap-project-from-cwd <scratch project>, so no seeded data) and Metro (expo start --dev-client --lan). Leased a Pixel 9 (API 36, Gboard) from the device pool, installed the cached dev client withvp run mobile:install android --session, paired it with the test-t3-mobile pair-client helper, and created one thread witht3 thread start(its turn failed on an unknown model, which cost nothing). Opened Terminal > Open new terminal and ranseq 1 200so the output reached the bottom. Hid the keyboard with the accessory bar's 'Dismiss keyboard' button, then recorded the screen while tapping the terminal to open the keyboard, dismissing it, and opening it again. Frame by frame: at 7.93s the keyboard is fully up, but the terminal is still full height, its prompt and last rows hidden under the keyboard, and there is no accessory bar. Nothing on screen changes until 9.11s. Then, in a single frame, the terminal moves up 21 rows (top line 152 -> 173) and the prompt and accessory bar appear above the keyboard. When the keyboard closed, the accessory bar slid down with it; I saw no snap on close. The 1.2s delay may be inflated by the remote emulator. Interactive dismissal, rotation and a second client attached to the same terminal session were not checked.Evidence
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests
vp test run src/features/terminal/terminalKeyboardShowing.test.ts: 2 passed; the new case fails without the source change (runWhenKeyboardSettles missing). vp run check:changed: format failed once, fixed with vp fmt, then all pass (format, lint, knip 1/2 and 2/2, typecheck of 2 packages, test of 1 file, react compiler on 2 files). Device: Pixel 9 API 36 with Gboard against an isolated server and Metro; shell WINCH trap counts (open: 1, close: 2) and a screen recording of the keyboard open, checked frame by frame.
Not in this change
AI-assisted; verified with the tests and tools listed above.