Skip to content

fix(mobile): dismiss Android keyboard when TextInput unmounts - #869

Open
adrienzheng-cb wants to merge 1 commit into
masterfrom
adrienzheng/cds-2620-dismiss-android-keyboard-when-textinput-unmounts
Open

fix(mobile): dismiss Android keyboard when TextInput unmounts#869
adrienzheng-cb wants to merge 1 commit into
masterfrom
adrienzheng/cds-2620-dismiss-android-keyboard-when-textinput-unmounts

Conversation

@adrienzheng-cb

Copy link
Copy Markdown
Contributor

What changed? Why?

Mobile TextInput now dismisses the Android soft keyboard when it unmounts while focused. An Android-guarded unmount cleanup effect calls Keyboard.dismiss() if the field was focused at unmount time. A focusedRef mirrors the latest focus state so the cleanup can read it without re-subscribing on every focus change. Includes 3 focused tests.

Root cause (required for bugfixes)

React Native does not dismiss the Android soft keyboard when a focused TextInput unmounts, unlike iOS which dismisses it automatically. This left the keyboard stranded on screen after the input was removed (e.g. navigating away or conditionally unmounting the field).

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Focus a mobile TextInput on Android, then unmount it (e.g. navigate away or toggle it off) — the keyboard should dismiss. On iOS the behavior is unchanged. See the 3 added tests in packages/mobile/src/controls/__tests__/TextInput.test.tsx.

Linear: https://linear.app/coinbase/issue/CDS-2620

Change management

type=routine
risk=low
impact=sev5

automerge=false

Made with Cursor

@linear

linear Bot commented Sep 1, 2026

Copy link
Copy Markdown

CDS-2620

@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

React Native leaves the Android soft keyboard open when a focused
TextInput unmounts (iOS dismisses it automatically), stranding the
keyboard on screen. Add an Android-guarded unmount cleanup effect that
calls Keyboard.dismiss() when the field was focused at unmount.

Refs CDS-2620

Co-authored-by: Cursor <cursoragent@cursor.com>
@adrienzheng-cb
adrienzheng-cb force-pushed the adrienzheng/cds-2620-dismiss-android-keyboard-when-textinput-unmounts branch from ca4f623 to 734eb71 Compare September 1, 2026 16:32
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants