Repository navigation
fix: remove native keyboard resize gaps on iOS and Android - #2034
goblincore wants to merge 10 commits into
Conversation
🦋 Changeset detectedLatest commit: e93dc4d The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
👋 Hey there! It looks like you modified code, but didn't update the documentation in If this PR introduces new features, changes APIs, or modifies behavior that users or developers need to know about, please consider updating the docs. 🏄 Windsurf TipYou can ask Windsurf to help:
Windsurf will review your changes and suggest appropriate documentation updates based on what was modified. 📚 Documentation Guide
This is an automated reminder. If no docs are needed, feel free to ignore this message. |
|
@claude please review |
|
Claude finished @goblincore's task in 2m 3s —— View job PR #2034 review: native keyboard resize gaps (iOS + Android)
Overall: The approach holds up. Letting native layout own the viewport, keeping web host sizing for overlay mode only, and expanding early on dismissal all match the root causes described. I compared the patches against the upstream 🟠 Should address1. A The other direction fails silently. Suggestions:
2. Scouts receives the native change too, but it isn't mentioned or tested. 🟡 Edge cases worth a look3. Android:
In both cases later non-IME inset changes keep a stale bottom padding: switching between gesture and 3-button navigation, rotation, or a cutout change. Clearing the flag defensively would cover this. One option is to clear it in the 4. Android: the order of 5. iOS: the native path no longer calls 6. iOS: 7. JS: 🟢 Nits
✅ What looks good
I did not run the unit tests or native builds. The checkout has no installed dependencies, and the native runners need a simulator or emulator. Everything above comes from reading the code and comparing it with the upstream 8.0.6 / 8.5.2 sources. |
✅ Capgo channel guard resolvedNo backwards-incompatible native change requires a channel bump on this PR’s current state. |
|
🚨 Warning: Approaching Monthly Automation Limit Monthly PRs automated: 228/250 Your organization has used over 90% of its monthly quota for gitStream automations. Once the quota is reached, new pull requests for this month will not trigger gitStream automations and will be marked as “Skipped”. To avoid interruptions, consider optimizing your automation usage or upgrading your plan by contacting LinearB. |
|
🥷 Code experts: Custard7 goblincore, Custard7 have most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
Custard7
left a comment
There was a problem hiding this comment.
The native timing changes should stay draft until the release binary and physical-device/ScoutPass checks. One cross-PR rollout dependency is not covered by the existing keyboard review.
| // LC-2157 remains latent: older binaries skip the optional bridge, | ||
| // and production provider registration stays disabled. | ||
| defaultChannel: '1.0.13', | ||
| defaultChannel: '1.0.14', |
There was a problem hiding this comment.
[P2] Reconcile channel numbers with the other native builds before publishing. #1808 and #1841 also choose LearnCard 1.0.14; #1841 chooses ScoutPass 1.0.9, which this PR also chooses. A binary built with just one of those changes should not share the same OTA channel as a binary whose bundle assumes the other native code. Rebase/reassign the later channels or explicitly ship a combined fresh binary together, and verify the actual upload target for both apps.
This addresses an issue with the capacitor keyboard plugin that I've always noticed on every capacitor app and makes them feel worse, which is this rather annoying white blank area that renders and lags behind the soft keyboard resize animation on native - this used to happen welibrary and happens now in learncard and scoutpass.
Original iOS synthetic comparison · 0.5× speed
ios-keyboard-comparison.mp4
Original iOS issue · actual LearnCard app · 0.25× speed
From the original November 11 screen recording, before the fix. Apps first, then Resume Builder; watch the blank white area lag behind the keyboard.
learncard-ios-original-issue-quarter-speed.mp4
iOS · fixed actual LearnCard Resume Builder
resume-builder-native.mp4
Android · actual LearnCard Resume Builder comparison · 0.5× speed
Before is on the left; fixed is on the right.
learncard-android-resume-comparison.mp4
Full-speed Android recordings
Before
learncard-android-resume-before.mp4
After
learncard-android-resume-after.mp4
What is this?
Fix the blank area exposed between LearnCard and the software keyboard during native opening and dismissal on iOS and Android. Synchronize Capacitor's native resizing with the keyboard and prevent the shared focus manager from imposing a competing host height.
This consolidates the Android work from #2062. Ionic routing, navigation transitions, and swipe-back behavior are unchanged.
How do I test this?
Setup: install dependencies and rebuild the native Debug binary so the Bun patches are compiled. Use a local frontend with Capgo auto-update disabled and the software keyboard enabled. For Android demo sign-in, use localhost through ADB reverse so WebCrypto is available.
Account-free native recording/check runners are documented in
apps/learn-card-app/tests/keyboard-focus/README.md: the iOS XCTest runner and Android instrumentation runner load/tests/keyboard-focus/animation.html. These supplement the actual-app videos above.Full context
Relevant Jira Issues
No Jira issue supplied.
Context and goal
On iOS, Capacitor Keyboard 8.0.6 defers native resizing until the keyboard animation duration plus 200 ms. Our focus manager could also retain the final keyboard-height constraint through dismissal. The upstream delay is tracked in capacitor-keyboard #19, with proposed fix #85. Animating WKWebView directly still flashed because WebKit lays out at the destination size immediately.
On Android, SystemBars applies destination IME padding before animation starts. The Keyboard callback previously left that final layout in place. The tested older WebView also briefly subtracts keyboard height again from VisualViewport, allowing another host shrink.
TL; RL
Let native layout own the viewport and keep rendered content ahead of the keyboard exposing it.
Feature breakdown
onPrepareto defer destination padding, then follow the opening IME animation's interpolated fraction while preserving other insets.Important tradeoffs
The version-specific Bun patches require a native binary rebuild; frontend OTA alone cannot install them. Android's
@capacitor/android@8.5.2and@capacitor/keyboard@8.0.6patches must ship together. Review the patches on dependency upgrades. Per-frame opening adds viewport layout work; physical-device performance and broader OS/IME coverage remain open.Types of Changes
Does this create any new technical debt?
Review follow-up
Addressed the review feedback:
Dependency pairing: pin Keyboard to
8.0.6in both native apps andlearn-card-base. A source-only CI guard checks the paired patches, exact manifest/lock versions, resolved versions, and patch files. The native dependency stays typed and explicit; upgrades must port and verify the pair.ScoutPass: document that it inherits both native patches, does not mount
KeyboardFocusManager, and needs native form QA. Include it in the release changeset.Android interruption/teardown: recover an abandoned padding deferral after the advertised duration plus 250ms (1250ms when unknown), cancel recovery work on teardown, and remove the callback when Keyboard is destroyed. Completion reconciles next frame instead of forcing an obsolete target, so replacement preparation can claim ownership.
iOS cleanup: reset the scroll view after final frame assignments; invalidate the display link/guide when leaving native mode and fence stale completions. Resize-mode cleanup runs on the main thread because plugin calls arrive on Capacitor's bridge queue.
Async detection: test delayed native-capability resolution after focus/opening on iOS and Android, including removal of fallback host heights and continued field visibility.
Maintenance: format the Java test, explain the legacy fallback catch, and add a patch changeset for LearnCard App, ScoutPass, and the shared library.
Latest channel/CodeQL comments: bump LearnCard's Capgo channel from
1.0.13to1.0.14and ScoutPass from1.0.8to1.0.9, keeping ScoutPass's checked-in platform configs aligned. Both apps require newly built native binaries for the keyboard patches. Replace first-occurrence slash escaping withreplaceAllin the patch guard and its fixture.Testing
Latest source-only follow-up:
8cf8b0097.node --test scripts/check-keyboard-patches.test.mjs(5 passed),node scripts/check-keyboard-patches.mjs, targetedbun scripts/lint-workspace.ts --files …, Prettier/pre-commit checks, andgit diff --checkpassed. The CI Capgo guard run locally against the PR base reports1.0.13→1.0.14,channelBumped: true, andguardFailed: false. CI's channel reader returns LearnCard1.0.14and ScoutPass1.0.9; both checked-in ScoutPass platform JSONs match its source config. No new native build or UI run was performed for these channel/string-replacement edits.Prior full regression commit:
53604b212dd2e47b6f00625352ffa8e7657f6d62. Results below remain historical evidence at that commit:The actual-app comparison videos above remain historical proof at iOS
7b52fd761and Androide21390722. The original November 11 issue footage has no established baseline commit. The latest native runs exercise the standalone fixture, not a new actual-app comparison.Proof
53604b212: iOS build + XCTest passed; Android build + 4 instrumentation tests passed7b52fd761implementation; original issue footage predates the fix8bad47bbfbaseline vse21390722fixed binary and matching frontendsThe original synthetic comparison, slower original iOS issue, and both actual-app platform videos remain visible at the top. New native fixture recordings and raw results are retained privately; visual review supplements interaction assertions. The unresolved first Android rapid-dismiss failure is described under Testing.
This is local native proof, not an
lc verifycatalog result. No Linux report is claimed.bun scripts/proof.ts doctorpassed repository/GitHub checks and reported media storage unconfigured. Raw sessions, tokens, traces, and logs remain private.Not verified
ScoutPass native forms; fresh actual-app flows at the review-follow-up head; physical iPhone/Android devices; newer iOS and Android/WebView/IME combinations; Android 11 cancellation ordering on-device and intermediate frames; iPad floating/split keyboards; rotation, hardware keyboard, split-screen, disabled animations, and background/resize-policy transitions beyond the listed tests. The initial intermittent Android rapid-dismiss failure remains an explicit QA item. Full Linux owned-stack catalog has not run from this macOS host. Keep draft for further review and device QA.
Which devices would you like help testing on?
Physical iPhone on newer iOS, iPad, and physical Android devices with current WebView plus an older supported Android release.
Code Coverage
Shared tests distinguish native resize ownership from overlay/legacy fallbacks and exercise reveal geometry, zoom, panning, and early dismissal. Native XCTest/JUnit runners drive real software-keyboard interactions; recordings require visual review as well.
Documentation
Updated the keyboard review README with recording/check commands, patch ownership, binary rebuild requirements, and remaining QA cases.
PR Checklist