Repository navigation
fix(mobile): keep the android keyboard closed when you scroll or swipe the terminal - #32038
Merged
Merged
Conversation
…nal touches Android's Back hides the IME but leaves its field focused, and the page's WebView raised it again on the next terminal scroll, swipe or flick. Fixes #31279
AmoabaKelvin
marked this pull request as ready for review
October 22, 2026 21:23
Merged
6 of 9 tasks
9 tasks done
10 of 11 tasks
10 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On Android, after you close the keyboard with Back, scrolling or swiping the terminal kept popping it back up. Now a keyboard you close stays closed until you tap something that opens it.
What Changed
Keyboard.dismiss(), the same dismissal the app uses elsewhere), so terminal touches can't bring the keyboard back. With the keyboard open, scrolling, swiping, flicking and tapping keep it open, as before.startBlurringOnKeyboardClose()inmobile/src/platform/keyboard-close-blur.web.tssubscribes to the page's keyboard close signal (the shell's reported keyboard height going to 0). The page entry starts it next topublishShellKeyboardSource. It does nothing on iOS.Why
Root cause: on Android the field keeps focus after the system hides the keyboard, so the page's "a field is focused" state no longer matches "the keyboard is up". While a field is focused, the WebView raises the keyboard again on terminal touches. With the field blurred, the same gestures leave it closed (checked over CDP in the emulator). Blocking the terminal's own touch listeners or default touch handling did not stop the re-raise, so the fix has to end the stale focus, not change the gesture code.
Left as is:
mobile/mobile-terminal-direct-input-default.md); making it optional is [Feature][Mobile]: Option to stop a plain tap on the terminal from opening the keyboard #17730.terminal-live-input.tsstays. Native screens and shells from before keyboard-height reports never send a close the page can see, and that fallback is still what reopens the keyboard for them.Linked Issue
Fixes #31279 (Linear STA-11437)
Visual Proof
Android emulator (release 0.0.58 shell, page served by a dev desktop). Each take: keyboard open, then scroll, swipe, flick and tap (it should stay open); close with Back; then scroll down, scroll up, flick and stop the coast, and swipe sideways (it should stay closed).
Android, before: the keyboard pops back up after every gesture in the closed state.
(screenshot removed: contained real product data)
Android, after: it stays closed.
(screenshot removed: contained real product data)
iOS simulator (same sequence; it closes with the dismiss key). No change: both states were already correct.
iOS, before:
(screenshot removed: contained real product data)
iOS, after:
(screenshot removed: contained real product data)
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
mobile/src/platform/keyboard-close-blur.web.test.tsruns react-native-web's realKeyboardandTextInputState. A field focused on Android loses focus when the shell reports the keyboard closed; on iOS it keeps focus. The Android case fails without the fix.Android emulator, driven over WebView CDP and
dumpsys input_method:Local checks: focused mobile tests, mobile
tsc, the tests-typecheck ratchet,check:code-quality:changed,check:react-doctor:changed.Agent skill upstream boundary
Notes
Mobile only, and only in the over-the-air page. Desktop, SSH and folder workspaces are unaffected. Mixed versions: older shells never report a close, so they behave as on main.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)