Skip to content

fix: keep iOS keyboard height in sync#341

Merged
Just-Insane merged 1 commit into
integrationfrom
codex/bug-issue-336-ios-keyboard-space
Jun 23, 2026
Merged

fix: keep iOS keyboard height in sync#341
Just-Insane merged 1 commit into
integrationfrom
codex/bug-issue-336-ios-keyboard-space

Conversation

@Just-Insane

Copy link
Copy Markdown
Collaborator

Description

Keep the mobile composer pinned to the live iOS visual viewport height while switching between keyboard modes such as text and emoji. This updates the synchronous CSS-height path in the iOS keyboard hook and adds a unit test for the immediate viewport-height selection logic.

Fixes #336

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).
    This patch changes useKeyboardHeight so --sable-visible-height keeps following the live visualViewport.height even after the keyboard is already open, which prevents stale height values from leaving a gap when iOS switches between text and emoji keyboards. It also extracts the immediate-height selection into a small helper and adds a focused unit test covering first-open estimation, no-estimate fallback, and already-open keyboard mode changes.

@Just-Insane Just-Insane enabled auto-merge (squash) June 23, 2026 16:48
@Just-Insane Just-Insane added the bug Something isn't working label Jun 23, 2026
@github-actions

Copy link
Copy Markdown

Sentry Preview Error Triage

No Sentry errors found for this PR's preview deployment as of Tue, 23 Jun 2026 16:48:13 GMT.

This comment updates automatically after each push.

@github-actions

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

Status Preview URL Commit Alias Updated (UTC)
✅ Deployment successful! https://pr-341-charm.justin-tech.workers.dev 684b6e7 pr-341 Tue, 23 Jun 2026 16:50:13 GMT

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: JavaScript

JavaScript / code-coverage/vitest

The overall coverage in the branch remains at 27%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File b5ed52d 0663428 +/-
src/app/feature...gSendDisplay.ts 100% 0% -100%
src/app/feature...age/Message.tsx 3% 3% 0%
src/app/hooks/i...yboardHeight.ts 4% 8% +4%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@Just-Insane Just-Insane merged commit 6291268 into integration Jun 23, 2026
20 checks passed
@Just-Insane Just-Insane deleted the codex/bug-issue-336-ios-keyboard-space branch June 23, 2026 16:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06634282a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +147 to +154
setCSSVars(
getImmediateVisibleViewportHeight(
baselineHeight,
viewport.height,
sharedSavedHeight,
cssVarsApplied
)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the saved-height estimate across all listeners

With the normal room screen, multiple useKeyboardHeight instances are mounted (RoomView, RoomTimeline, and RoomInput all call it), so all of their visualViewport.resize handlers run for the same first keyboard-open resize. The first handler sets cssVarsApplied = true inside setCSSVars, then later handlers reach this unconditional call with varsAlreadyApplied true and overwrite the saved-height estimate with the transient live viewport height, defeating the first-open estimate that avoids composer/timeline jumps. Consider only switching to live viewport updates when the variable was already applied before this resize event, or otherwise keep the shared estimate until the open stabilizes.

Useful? React with 👍 / 👎.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS Keyboard Space

1 participant