Skip to content

feat(keyboard): keyboardWillShow / keyboardWillHide give no way to match the OS keyboard animation (duration, curve) #2613

Open

Description

@tzdevelopteam

Plugin

Keyboard

Current Behavior

keyboardWillShow carries only keyboardHeight (definitions.d.ts L60–66, KeyboardInfo), and keyboardWillHide carries nothing (Keyboard.m L219 notifyListeners:@"keyboardWillHide" data:nil). The OS animation that moves the keyboard is not reported, although the plugin has it in hand on both platforms:

  • Android — the WindowInsetsAnimationCompat.Callback in Keyboard.java (L76–121) receives the IME animation in onStart(animation, bounds); animation.getDurationMillis() and animation.getInterpolator() are available there, but only the height is forwarded (onKeyboardEvent(EVENT_KB_WILL_SHOW, Math.round(imeHeight / density)), L104). The duration and the interpolator vary by OEM and IME — we measured 285 ms with a non-linear interpolator on Samsung One UI against a different curve on the AOSP keyboard — so no constant on the web side can match them.
  • iOS — Keyboard.m L257 reads UIKeyboardAnimationDurationUserInfoKey for its own webview resize (+0.2), and UIKeyboardAnimationCurveUserInfoKey is in the same userInfo; neither reaches JS.

The effect: anything the web layer pins to the keyboard — a chat composer, a toolbar, a bottom sheet — has to animate with a guessed duration and easing, and visibly lags or overshoots the keyboard as it opens and closes. On Android the mismatch changes from device to device. This is the same gap ionic-team/capacitor#2304 described in 2020 (closed as "tracked for reactions" and later locked); the inset-animation API on Android did not exist then and does now.

Expected Behavior

The keyboardWillShow / keyboardWillHide events give the web layer enough about the OS animation (its duration and its curve, as the platform reports them) to move a pinned element in step with the keyboard, instead of guessing.

Platform(s)

  • Android
  • iOS

Steps to Reproduce

  1. Pin an element to the keyboard: on keyboardWillShow set its bottom to keyboardHeight with a CSS transition, on keyboardWillHide set it back to 0.
  2. Open and close the keyboard on a Samsung device and on a Pixel.
  3. With any fixed transition duration/easing, the element either trails behind the keyboard or arrives before it, and the gap differs between the two devices, because the plugin reports only the final height.

Additional Context

@capacitor/keyboard 8.0.6, Capacitor 8.

Activity

  1. changed the title [-]feat(keyboard): report the OS keyboard animation (duration + curve) on keyboardWillShow / keyboardWillHide[/-] [+]feat(keyboard): keyboardWillShow / keyboardWillHide give no way to match the OS keyboard animation (duration, curve)[/+] on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions