Skip to content

[BUG] PaymentSheet: keyboard dismisses on every card field auto-advance (Android 16) #13378

Description

@andrey2ag

Summary

In PaymentSheet's card form, when a field is completed (16th card number digit, 4th expiry digit, 3rd CVC digit), focus correctly auto-advances to the next field, but the soft keyboard dismisses. The user has to tap every field to bring the keyboard back. iOS PaymentSheet auto-advances with the keyboard staying open.
We traced it with ImeTracker and a debugger. On field completion, Compose's legacy text input pipeline issues an explicit IME hide during the focus handoff:

InsetsController.hide
← SoftwareKeyboardControllerCompat.hide
← androidx.compose.ui.text.input.InputMethodManagerImpl.hideSoftInput
← TextInputServiceAndroid.setKeyboardVisibleImmediately
← TextInputServiceAndroid.processInputCommands

ImeTracker shows the sequence: client hide (HIDE_SOFT_INPUT_BY_INSETS_API), then the next field's ATTACH_NEW_INPUT show request, which is cancelled by a system hide (IME_REQUESTED_CHANGED_LISTENER). The hide wins, so the keyboard stays down.

The old field's input session stops in one frame and the next field's session starts in a later frame, so the intermediate hide actually runs. A minimal Compose app with the same pattern (NumberPassword fields + LaunchedEffect + moveFocus(Next) on completion) does not reproduce this — the stop/start coalesce in one frame and the keyboard stays open. So it's specific to the PaymentSheet form structure, not generic Compose.

Code to reproduce

paymentSheet.presentWithIntentConfiguration(
     intentConfiguration = PaymentSheet.IntentConfiguration(
         mode = PaymentSheet.IntentConfiguration.Mode.Setup(setupFutureUse = OnSession),
     ),
     configuration = PaymentSheet.Configuration.Builder("Example").build(),
 )
 1. Open the card form, tap Card number
 2. Type 4242 4242 4242 4242
 3. Focus moves to MM/YY, keyboard dismisses
 4. Same happens on completing MM/YY and CVC

Android version

Reproduced on Android 16 (Pixel 6 physical device and API 36 emulator).
SDK version: 23.11.0 (also reproduced on 21.29.2 — long-standing).

Impacted devices

(Pixel 6 physical device and API 36 emulator).

Installation method

Gradle, com.stripe:stripe-android:23.11.0.

Dependency Versions

kotlin: 2.4.0
stripe-android: com.stripe:stripe-android:23.11.0
Android Gradle Plugin: 9.2.1
Gradle: 9.6.0

SDK classes

com.stripe.android.paymentsheet.PaymentSheet (presented via presentWithIntentConfiguration), PaymentSheetActivity. The behavior itself is in the internal form components: com.stripe.android.uicore.elements.TextField (TextFieldUI.kt, the LaunchedEffect that calls moveFocusSafely on field completion) and com.stripe.android.ui.core.elements.CardDetailsElementUI.

Video

screen-20260306-170552-1772845523638.mp4

Other information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions