Repository navigation
Description
Steps to reproduce
- On an iPhone, enable a third-party keyboard extension (seen with the Korean keyboard 한글키 from the App Store) and make it the active keyboard.
- In a Flutter app, tap a
TextFieldso the keyboard shows. Any layout that followsMediaQuery.viewInsetsOf(context).bottommakes it visible (e.g. aScaffoldwithresizeToAvoidBottomInset, a bottom sheet withPadding(viewInsets), aDialog). - Dismiss the keyboard and tap the field again; repeat.
Expected results
viewInsets.bottom rises monotonically with the keyboard and arrives with it.
Actual results
In about half of the taps, viewInsets.bottom rises, then drops by 47–122 pt (median 66 pt) about 110 ms after the tap, and then rises again on a slow ease-in-out curve. It arrives ~70–90 ms after the non-dropping case (median 505–525 ms vs 434 ms from the tap). The keyboard itself does not do this: it keeps following its original spring and arrives at ~458–466 ms, so content first moves down and then trails the keyboard by up to ~210 pt.
With the system Korean keyboard on the same device and build: 0 of 12 taps.
Measured on a real device (iPhone 17 iPhone18,3, iOS 27.2, 120 Hz, profile build) with an integration-test harness: 44 taps, 25 dropped. For each tap we logged, on the same clock (CLOCK_MONOTONIC_RAW, aligned to FrameTiming.vsyncStart): every keyboard notification, the engine's keyboard-inset decisions and output (updateViewportMetricsWithInset:, swizzled for measurement only), the system keyboard's position (UIRemoteKeyboardWindow > UIInputSetHostView presentation layer), and viewInsets.bottom per frame.
What happens (every dropped tap, and in none of the others)
- ~72 ms after the tap, UIKit posts
WillChangeFrame+WillShowwith begin frameCGRectZeroand end frame(0, 532, 402, 342), duration 0.383 s, inside the keyboard's spring animation block (UIView.inheritedAnimationDuration= 0.383). Becausebegin.y (0) > end.y (532)is false, the manager records the animation as not showing, then starts a spring (k 555.03, c 47.12, m 1) toward 342 pt. Taps that don't drop end here. - 110–152 ms after the tap, the keyboard extension reports a transient height:
Did/WillChangeFrame+Showwith end frame(0, 733, 402, 141)— posted outside any animation block (inheritedAnimationDuration= 0). Direction is again "not showing" (532 > 733is false) and the vsync client is alive, so the animation is treated as compounding and only the spring'stoValuechanges, 1026 → 423 px. The spring value is proportional totoValue - fromValue, so the reported inset immediately drops to ~141/342 of its value. - 12–27 ms later the extension reports 342 pt again (
(0, 733, …141)→(0, 532, …342)), also outside an animation block. Now733 > 532is true, the direction differs, sostartKeyBoardAnimationrestarts from the dropped current inset (50–97 pt). Since the call isn't inside the keyboard's animation block,animateWithDuration:produces aCABasicAnimationwith the default ease-in-out curve (0.42, 0, 0.58, 1) instead of aCASpringAnimation, so the manager falls back to the presentation layer and starts slowly.
Engine-reported and Dart-observed drops matched on all 44 taps (same verdict, same magnitude). On taps without the transient, the engine inset tracks the keyboard closely (median difference ~2 pt at the frame's target time).
The same logic is on master (5aa30617), engine/src/flutter/shell/platform/darwin/ios/framework/Source/KeyboardInsetManager.swift: direction and compounding at lines 151–161, restart at 325, presentation-layer fallback at 407–408, spring setup at 444–456. Observed on 3.47.6 (FlutterKeyboardInsetManager.mm lines 77–88, 273–275, 374–379).
Possible directions (not verified)
- Treat an empty begin frame (
CGRectZero) onWillShowas a showing animation, so the direction check isn't inverted. - While a show animation is in flight, a frame change that is posted outside an animation block and is followed by a return to the previous height could be ignored or coalesced; at least, lowering
toValuemid-show should not make the reported inset go down. - When restarting outside an animation block, reuse the previous spring parameters rather than the default
UIViewcurve.
Related: #193343 (same area — a height change mid-animation followed by a hide yields a huge negative inset for one frame; different cause and symptom).
Code sample
Code sample
Any TextField in a Scaffold. The numbers above come from our app's integration-test harness; I haven't built a separate minimal app, but nothing app-specific is involved — the drop is in the engine's reported inset.
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
Flutter 3.47.6 • channel stable • framework revision 5fc346839b (2026-09-30) • engine revision 692136cb65 • Dart 3.13.5
Activity
suryaKommana2662 commentedon Nov 16, 2026
@ysjkof Thanks for the report. Could you please provide a minimal reproducible example demonstrating this issue? Also, please verify whether the issue is still reproducible on Flutter 3.50.0 stable.
If possible, could you also share a short video demonstrating the keyboard animation issue? These details would help us reproduce the behavior and investigate the issue further.