fix(web): detect Firefox Android software keyboards#22538

open4
main
GitHub fork: contribution/macroscope-firefox-keyboard
opened9d agobyZzainmitchell
View on GitHubTwo-way sync enabledPR last imported 16h ago

Firefox Android can shrink the layout and visual viewports together when the software keyboard opens. The equal-height check then reports the keyboard closed, allowing Enter to submit and skipping dismissal after send. On coarse-pointer devices, also compare the layout height with the tallest height observed at the current width. This covers a keyboard opening before the composer subscribes and resets the baseline on width changes.

Verification: the two new Firefox-style cases failed against the original code; all 17 focused tests pass with the fix. I independently reran those tests in a Node-only configuration with exit 0. Scoped lint, formatting and the web typecheck pass. Tests cover dismissal, keyboard height changes, pinch zoom, rotation and fine-pointer window resizing.

No real Firefox Android/device verification was performed. A large same-width split-screen resize can resemble a keyboard, and rotation with the keyboard still open remains undetected until a new full-height baseline is observed.

Implemented by Claude Opus 5.5 High through the Claude harness in T3 Code. Reviewed and independently checked by GPT-6.1-Sol through Codex in T3 Code.

Checks

21 successful · 8 skipped
All checks passed
3fdab5f

Added 1 commit

  • fix(web): detect keyboards that resize the layout viewport8369464
Synced from GitHub

Approvability

Verdict: Approved at 8369464

Macroscope's review found this PR approvable — This is a focused fix to software-keyboard detection for Firefox Android, with production behavior confined to keyboard-state handling and regression tests covering the new cases. It does not modify product defaults, schemas, infrastructure, or static-analysis settings.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

Important

Review skipped

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

External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between ff56ef5ca9cd965b9a62a1320b17cf4af40b32ba and 3fdab5f63f70841691c186efb252cb39a59d74fe.

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.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between f0dd86f16482595c6cfffe0ac64dc12bffb634f9 and ff56ef5ca9cd965b9a62a1320b17cf4af40b32ba.

External image Files selected for processing: 2
  • apps/web/src/lib/softwareKeyboard.test.ts
  • apps/web/src/lib/softwareKeyboard.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The software keyboard store now detects keyboard state from layout viewport shrinkage on coarse-pointer windows. Resize and initial-state detection use this check alongside existing visual viewport checks.

Changes: Coarse-pointer keyboard detection

Layer / File(s)Summary
Track layout height
apps/web/src/lib/softwareKeyboard.ts, apps/web/src/lib/softwareKeyboard.test.ts
KeyboardWindow includes layout dimensions and matchMedia. The store tracks the largest layout height per width for coarse-pointer windows and detects shrinkage greater than 150px.
Apply detection and validate state changes
apps/web/src/lib/softwareKeyboard.ts, apps/web/src/lib/softwareKeyboard.test.ts
Resize and initial-state detection use layout shrinkage alongside visual viewport checks. Tests cover layout-resizing keyboards, zoom, closure, reopen cycles, and keyboards open before subscription.

Priority: External image Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • pingdotgg/t3code#22751 — The reported Android split-screen case involves the software keyboard hiding the web composer. This change adds coarse-pointer viewport detection for keyboard state.
  • pingdotgg/t3code#19512 — The reported iOS Safari case involves software-keyboard viewport behavior. This change also updates web software-keyboard detection, but the issue describes a different viewport pattern.

Suggested labels: bugfix

Suggested reviewers: yash-singh1

Merge Risk: External image Minimal · previous review ff56e

The tested pre-subscription keyboard case is detected. No identified issue blocks merging after normal checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description clearly explains the problem, implementation, verification, limitations, and agent usage. However, it omits the required scope and approval information, including a triaged issue, main…Add a Scope and approval section. Link the relevant issue or maintainer approval with the approval comment, or explain why this focused fix qualifies as an obvious bug fix without prior approval. Add the template headings for Problem, Chang…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely identifies the main change: fixing software keyboard detection on Firefox Android.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the problem, implementation, verification, limitations, and agent usage. However, it omits the required scope and approval information, including a triaged issue, maintainer approval, or a rationale for treating this as an obvious focused bug fix.

Resolution

Add a Scope and approval section. Link the relevant issue or maintainer approval with the approval comment, or explain why this focused fix qualifies as an obvious bug fix without prior approval. Add the template headings for Problem, Change, Scope and approval, and Verification if required by repository conventions.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Synced from GitHub

tested locally, it resolved the same issue ( introduced with #21763 ) in android chrome

Added 2 commits

  • chore: merge main into firefox keyboard fix5edbe10
  • refactor(web): clarify layout keyboard fallbackff56ef5

Note

Written by gpt-6.1-sol on behalf of Maria

thanks @zainmitchell. your coarse-pointer layout-height fallback correctly covers android browsers that shrink both viewports together. i preserved your commit, merged current main, resolved the existing-test conflict, and shortened the browser-quirk comment. the final diff is two files, +75/-5; unrelated tests removed on main stay removed.

verification at ff56ef5ca9cd965b9a62a1320b17cf4af40b32ba:

  • reproduced both firefox-style regression failures against main before applying the fix.
  • blacksmith: 74 focused keyboard/composer tests passed. vp run check:changed passed format, lint, both knip passes, affected typechecks, and 13 keyboard tests.
  • real app in system chrome with mobile touch/coarse-pointer emulation: layout and visual viewports both shrink from 844px to 500px at 390px width. main sends on enter. this head inserts a newline with no websocket submission; pressing send dispatches exactly once and blurs the editor.
  • published checks are green and github reports no conflicts. two independent code reviews found no code issues.
  • unverified: physical android software keyboard and firefox android. desktop chrome emulation verifies the viewport and composer paths, not a device keyboard.
  • known limits retained from the original: a large same-width split-screen resize can resemble a keyboard; rotating while the keyboard is open requires a new full-height baseline.

scope and approval: maria explicitly requested this focused takeover of #22538. the description warning about missing prior approval is addressed by this authorization; no broader feature work was added.

matching draft before enter on main: main draft with both viewports at 500px

matching draft before enter with fix: fixed draft with both viewports at 500px

main after enter: main accidentally submits on enter

fix after enter: fix keeps a newline in the composer

enter inserts a newline then send dispatches and blurs

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified as-is at ff56ef5ca9cd965b9a62a1320b17cf4af40b32ba. no code changes or pushes.

ran vp i and a background dev server on github/main (afc233492d), then stopped it before installing and starting this exact head. used isolated state, the actual web app, repository playwright, and /usr/bin/google-chrome. created projects pointing at /home/user/t3code and threads through the app. all replies came from real codex gpt-6.1-sol through the local proxy, without mocks or replay data.

with touch/coarse-pointer emulation, resized both real browser viewports from 390 × 844 to 390 × 500:

  • main: enter submitted the draft and codex returned ENTER_OK, reproducing the bug.
  • pr: enter inserted a newline; typing continued in the draft, with no websocket message dispatch. clicking send dispatched exactly one message.dispatch with model codex/gpt-6.1-sol, blurred the editor (document.activeElement became BODY), and received ENTER_OK.
  • nearby behavior: restoring full height made enter submit normally and return RESTORED_OK. ctrl+enter while shrunk still submitted and returned MODIFIER_OK. each produced exactly one dispatch.

short runtime transcript:

text
1main: innerHeight=844 visualViewport.height=844 pointer=coarse
2main: innerHeight=500 visualViewport.height=500 -> enter -> ENTER_OK
3pr: innerHeight=500 visualViewport.height=500 -> enter -> newline, 0 dispatches
4pr: send -> 1 dispatch, editor blurred -> ENTER_OK
5pr: restored viewport -> enter -> RESTORED_OK
6pr: shrunk viewport -> ctrl+enter -> MODIFIER_OK

blacksmith: 74 focused keyboard/composer tests passed. vp run check:changed against the pr's base passed format, lint, both knip passes, affected typechecks, and 13 keyboard tests. fetched the base history on the worker after its initial shallow-checkout merge-base error. inspected all screenshots and the 8-second recording, and checked uploaded video playback and seeking in t3's browser.

matching draft on main:

main draft before enter at 390 by 500

matching draft on the pr:

pr draft before enter at 390 by 500

main after enter accidentally submits:

main submits on enter and receives the provider reply

pr after enter keeps the newline in the draft:

pr preserves the draft and inserts a second line

pr enter inserts a newline then send blurs and receives a real codex reply

Not verified

physical android software keyboards and firefox android are unavailable on this linux vm. chrome viewport emulation proves the changed viewport/composer/provider path, but does not prove a physical keyboard or firefox implementation. native ios/android clients, electron, macos/windows, pinch zoom, rotation, and split-screen were not exercised in a real client. the existing heuristic limits around same-width split-screen and rotation with the keyboard open remain. no claim of physical-device verification.

Added 1 commit