Skip to content

fix(mobile): route the bottom drawer's keyboard through the platform seam (OTA phase C follow-up) - #22556

Merged
Jinwoo-H merged 5 commits into
mainfrom
ota-fu-page-sheet-keyboard
Sep 23, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
ota-fu-page-sheet-keyboard

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​442 $\color{#cf222e}{\Huge{\mathbf{−}}}$​32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​410
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​104 $\color{#cf222e}{\Huge{\mathbf{−}}}$​48 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​56

Why

On the hybrid-shell page, opening any fill-mode bottom sheet (the create-worktree name sheet, for one) threw Keyboard.metrics is not a function, the page's renderer crashed and the shell re-downloaded the workspace. mounted-bottom-drawer.tsx read Keyboard.metrics() and subscribed to Keyboard events directly; react-native-web's Keyboard stub has no metrics. Found by the page-vs-native visual audit.

What

The page must not ask React Native's Keyboard for geometry: on the page the shell owns the keyboard (it shortens the WebView) and the platform seam mobile/src/platform/keyboard-occlusion.ts / .web.ts already knows that. The seam now exports an imperative pair, subscribeSoftKeyboard(onShow, onHide) and currentSoftKeyboardHeight(); native builds useSoftKeyboard on the same subscribe (no metrics() seed there, so the iOS will-hide/did-hide window stays confined to the fill-sheet seed exactly as before); web answers from visualViewport (0 inside the shell, the covered strip in a plain browser) and starts its open flag from the current strip so a keyboard already up when subscribing still fires the hide. The drawer's effect is the base version with those two calls swapped; nothing else in it changed. The keyboard-geometry census now covers Keyboard.metrics( and has no drawer exemption.

Proof

  • Red first: drawer web test throws Keyboard.metrics is not a function on base; seam sequence test expected [] to deeply equal [ 'hide 0' ] before the open-flag fix; census red on base.
  • Opus design review, three rounds: two must-fix items in the first shape (a metrics seed in the shared seam, and event-stream state in the drawer) were removed; the last round confirmed nothing else must change.
  • Emulator (OrcaReopenPaint, OTA APK from 641a7f3, page served from this branch): before, tapping the name field logs $.Keyboard.metrics is not a function + Renderer process crash detected and the workspace re-downloads; after, the sheet opens and the field focuses with 0 faults; sheet bottom 1847 on WebView bottom 1848 = keyboard top 1848.
  • Lead gate on 676675f: every lint and typecheck line 0; mobile 870 files / 9488 tests; config/scripts 2394 pass with two load flakes (mobile-web-app-frame-budget-sweep, pr-workflow-parallelism) that pass solo (25/25) and passed in the previous gate on this branch.

…seam

Fill-mode sheets called Keyboard.metrics() directly, which react-native-web
does not implement, so opening one on the page threw and the shell
re-downloaded the workspace. The drawer now reads useSoftKeyboard, whose
native half seeds from metrics() and carries the event duration, and whose
web half answers from the window (duration 0). The fill/content-sized seed
rule and resolveBottomDrawerKeyboardInset are unchanged. A census keeps
Keyboard.metrics/addListener inside the seam plus the tab-sheet hide wait.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…nsus

The bottom drawer now reads the keyboard seam, so no module in the
source-control or review closures names react-native-web's Keyboard stub.
The census also flags Keyboard.metrics, which the stub lacks.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…e seam

The seam now exports subscribeSoftKeyboard and currentSoftKeyboardHeight
beside its hooks. The drawer's effect is back to its original shape with
only its Keyboard calls swapped for the pair, and useSoftKeyboard is back
to {height, visible} with no metrics() seed. Seeding every consumer opened
an iOS window between willHide and didHide where metrics() still reads
open. The web pair answers from visualViewport, so it stays silent inside
the shell and lifts sheets in a plain mobile browser.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
A keyboard already covering the page when subscribeSoftKeyboard attached
never produced onHide when it closed, so the occlusion hook and a seeded
fill sheet stayed lifted. Outside the shell only.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 30c38828-46c5-414d-9542-721bd4889dc4

📥 Commits

Reviewing files that changed from the base of the PR and between 676675f and d9c5913.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e4fafa84-0c8a-4ea8-b3ac-b9709caee075

📥 Commits

Reviewing files that changed from the base of the PR and between f1eb191 and 676675f.

📒 Files selected for processing (9)
  • config/scripts/mobile-web-app-source-control-keyboard.test.mjs
  • mobile/src/components/mounted-bottom-drawer-keyboard-seam.test.tsx
  • mobile/src/components/mounted-bottom-drawer-page-keyboard.web.test.tsx
  • mobile/src/components/mounted-bottom-drawer.tsx
  • mobile/src/platform/keyboard-geometry-owner-census.test.ts
  • mobile/src/platform/keyboard-occlusion.test.tsx
  • mobile/src/platform/keyboard-occlusion.ts
  • mobile/src/platform/keyboard-occlusion.web.test.tsx
  • mobile/src/platform/keyboard-occlusion.web.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change adds native and web functions to read the current soft-keyboard height and subscribe to keyboard events. MountedBottomDrawer uses these functions to initialize and update its inset. New tests cover keyboard events, animation durations, cleanup, and web layout after a window resize. Census tests check which source modules query keyboard geometry.

Merge Risk: ⚪ Minimal · up to 67667

The bottom drawer now reads keyboard state through the shared platform layer instead of calling React Native's keyboard API directly. This avoids the crash reported when fill-mode sheets open inside the hybrid web shell, while native keyboard lifting behaves as before. Tests cover native events, cleanup, and web layout when the window resizes. No blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, implementation, rationale, and validation results, but it omits required template sections, including the linked issue, visual proof or an explicit N/A explanatio… Complete the required template sections. Add the linked issue after “Fixes #”, attach before-and-after visual proof or state N/A with a reason, complete the Testing section and platform coverage, disclose AI use if applicable, complete the …
Docstring Coverage ⚠️ Warning Docstring coverage is 45.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: routing the mobile bottom drawer's keyboard handling through the platform seam.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, implementation, rationale, and validation results, but it omits required template sections, including the linked issue, visual proof or an explicit N/A explanation, the Testing checklist, and the remaining checklist and review sections.

Resolution

Complete the required template sections. Add the linked issue after “Fixes #”, attach before-and-after visual proof or state N/A with a reason, complete the Testing section and platform coverage, disclose AI use if applicable, complete the Agent skill upstream boundary, Notes, Review, and Checklist sections.

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

  • Drawer routed through the keyboard seam — mounted-bottom-drawer.tsx drops the direct Keyboard.metrics() seed and Keyboard.addListener pair for currentSoftKeyboardHeight() / subscribeSoftKeyboard; the native effect keeps its fill-only seed, duration fallbacks, and unsubscribe behavior.
  • Seam gains an imperative pair — both keyboard-occlusion.ts and .web.ts export subscribeSoftKeyboard(onShow, onHide) and currentSoftKeyboardHeight(); native useSoftKeyboard now delegates to the pair, web's useKeyboardOcclusion composes them (seeding its lift from the same strip and starting its open flag from it so an already-up keyboard still fires the hide).
  • Page-safe geometry — the web sibling answers from visualViewport's uncovered strip and returns 0/noop with no viewport, so a sheet on the hybrid-shell page never asks RN's Keyboard (whose web stub has no metrics) for geometry.
  • Censuses tightened — the source-control/review closure test drops the mounted-bottom-drawer.tsx exemption and now also catches Keyboard.metrics(; a new whole-src census pins geometry readers to the seam plus the named tab-sheet file.
  • Tests — drawer-vs-seam, drawer-vs-react-native-web, and the new seam pair (already-up seed, hide-once, no-viewport) cover the changed paths.

I traced the native extraction against the previous effect (event/duration/seed semantics preserved), confirmed the web refactor of useKeyboardOcclusion is equivalent to the old read()-on-mount subscription, and verified by grep that the new census's expected two readers are the only non-test files in mobile/src containing Keyboard.metrics(/Keyboard.addListener(. The one behavioral change beyond the crash fix is that content-sized web sheets now lift on keyboard show where they were previously inert — an improvement.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 5b6a857 into main Sep 23, 2026
58 of 60 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-fu-page-sheet-keyboard branch September 23, 2026 23:47
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.

1 participant