Skip to content

fix(bottom-sheet): stop keyboard disappearing after sheet dismissal - #21471

Draft
claudiiafg wants to merge 1 commit into
developfrom
fix/LIVE-36689_edit-keyboard
Draft

fix(bottom-sheet): stop keyboard disappearing after sheet dismissal#21471
claudiiafg wants to merge 1 commit into
developfrom
fix/LIVE-36689_edit-keyboard

Conversation

@claudiiafg

@claudiiafg claudiiafg commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Previous behaviour: on Mobile, tapping Edit contact > Edit Name opened the rename drawer with the keyboard, and the keyboard then vanished instantly. The sheet stayed open and correctly sized; tapping the name field brought the keyboard back and it stayed.

Cause: a QueuedBottomSheet retracted the keyboard twice on its way out — once when the close animation starts (handleClose / handleAnimate) and again unconditionally when gorhom's onDismiss landed. Keyboard.dismiss() is global, not scoped to the calling sheet.

Tapping "Edit name" closes the actions-menu sheet and opens the rename drawer in the same React commit. The actions menu retracted the keyboard at close-start (a no-op — nothing was focused yet), the rename drawer then opened and focused its field so the keyboard rose, and only afterwards did the actions menu's onDismiss arrive and pull that keyboard down. That callback can land hundreds of milliseconds late, which is why the hook already carries a 600 ms DISMISS_FALLBACK_DELAY_MS for the case where it never arrives at all.

Fix: handleDismiss now retracts the keyboard only when the dismissal bypassed the close animation, the one case where nothing has retracted it yet. A dismissal that follows an orderly close leaves the keyboard alone, so it can no longer steal focus from the sheet that replaced it.

This is the same class of bug the legacy drawer fixed with its preventKeyboardDismissOnClose opt-out; the shared queued-sheet package had no equivalent guard. Fixing it in the shared hook covers every sheet-to-sheet hand-off rather than just this flow, and needs no opt-in from callers.

Regression cover: two tests in useQueuedBottomSheet.native.test.ts pin both branches — a dismissal that bypasses the close still retracts the keyboard, and one landing after an orderly close leaves it alone.

Checked against the earlier LIVE-35853 fix, where retracting the keyboard as an edit-address sheet closes is needed so the sheet underneath lays out correctly: that retraction happens at close-start and is untouched.

I deliberately did not add a focus retry to ContactNameInput — that would paper over the race rather than remove it.

🔗 Context

  • JIRA / GitHub issue: LIVE-36689
  • ADR (if any): n/a

@claudiiafg claudiiafg self-assigned this Sep 2, 2026
Copilot AI lite review requested due to automatic review settings September 2, 2026 21:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The behavioral change is narrowly scoped, matches the described root cause, and is covered by targeted regression tests for both relevant branches.

Pull request overview

This PR fixes a Mobile keyboard race where a QueuedBottomSheet could dismiss the keyboard twice: once at close-start and again later when Gorhom’s onDismiss callback finally fires, unintentionally hiding the keyboard that a newly opened sheet just raised.

Changes:

  • Update handleDismiss to only retract the keyboard when the dismissal bypasses the close animation (i.e., when the sheet is still "open").
  • Add regression tests covering both the “bypass close animation” branch and the “orderly close then late onDismiss” branch.
  • Add a changeset to publish the fix as a patch for the shared package and Mobile app.
File summaries
File Description
shared/ui-queued-bottom-sheet/src/internals/useQueuedBottomSheet.native.ts Avoids late onDismiss keyboard dismissal after an orderly close to prevent stealing focus from the next sheet.
shared/ui-queued-bottom-sheet/src/internals/useQueuedBottomSheet.native.test.ts Adds tests to pin keyboard-dismiss behavior for bypassed-close vs orderly-close scenarios.
.changeset/LIVE-36689-edit-contact-keyboard.md Declares patch releases for the shared bottom-sheet package and live-mobile.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Web Tools Build Status

Build Status Deployment
Web Tools Build ✅ Deployed https://web-tools-4rwh1wvrl-ledger-hq-prd.vercel.app

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 7 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
desktop-main 2.5 MB - 0 -
desktop-preloader 7.1 KB - 0 -
desktop-renderer 82.4 MB - 0 -
desktop-webviewDappPreloader 36.9 KB - ❓ 0 -
desktop-webviewPreloader 200.0 B - 0 -
desktop-workers 36.8 KB - 0 -
mobile 129.5 MB - +264.0 B (0.0%) -
📋 Detailed Reports (Click to expand)

📁 mobile

Path: rsdoctor/mobile/rsdoctor-data.json

📌 Baseline Commit: d80a0e0f653302623aa09406ab8ff0358546386b | PR: #21398

Metric Current Baseline Change
📊 Total Size 129.5 MB 129.5 MB +264.0 B (0.0%)
🗜️ Gzip Size - - -
📄 JavaScript 114.0 MB 114.0 MB +264.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 15.5 MB 15.5 MB 0

📦 Download Diff Report: mobile Bundle Diff

Generated by Rsdoctor GitHub Action

@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants