Skip to content

fix[ios channels]: scroll message list when input focused"#2452

Merged
peterchinman merged 4 commits intomainfrom
peter/scroll-channel-when-input-focused
Apr 8, 2026
Merged

fix[ios channels]: scroll message list when input focused"#2452
peterchinman merged 4 commits intomainfrom
peter/scroll-channel-when-input-focused

Conversation

@peterchinman
Copy link
Copy Markdown
Contributor

@peterchinman peterchinman commented Apr 8, 2026

on iOS we need to scroll the message list, when the user is near the bottom, when the main input is focused.

@peterchinman peterchinman requested a review from a team as a code owner April 8, 2026 20:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

Introduces an iOS-specific main-input keyboard handler and a shared near-bottom constant. Channel.tsx now exposes the main input element via a Solid signal and wires the new handler to scroll the message list to bottom when the keyboard appears if the list was previously near bottom.

Changes

Cohort / File(s) Summary
Channel input & handler
js/app/packages/channel/Channel/Channel.tsx, js/app/packages/channel/Channel/create-main-input-keyboard-handler.ts
Added channelInputEl signal and updated ChannelInputContainer ref to store the element. Introduced createMainInputKeyboardHandler(...) which listens for touchstart to track "near bottom" state and reacts to keyboardWillShow on iOS to call navigation()?.scrollToBottom(). Listeners are scoped and cleaned up.
Scroll threshold constant
js/app/packages/channel/Channel/constants.ts, js/app/packages/channel/Channel/ThreadList.tsx
Extracted local NEAR_BOTTOM_THRESHOLD = 50 into an exported NEAR_BOTTOM_THRESHOLD constant and updated ThreadList.tsx to import and use it.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format with 'fix' prefix and clearly describes the main change: scrolling message list when input is focused on iOS channels.
Description check ✅ Passed The pull request description directly describes the changeset: implementing iOS-specific functionality to scroll the message list when the input is focused.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@js/app/packages/channel/Channel/create-main-input-keyboard-handler.ts`:
- Line 5: NEAR_BOTTOM_THRESHOLD is duplicated; extract it into a single exported
constant in a shared module (e.g., create a exported NEAR_BOTTOM_THRESHOLD in a
common/constants or channel/constants file) and replace the local declaration in
create-main-input-keyboard-handler.ts and the one in ThreadList.tsx with imports
from that shared module so both scroll logic paths use the same constant (update
any references to NEAR_BOTTOM_THRESHOLD accordingly).
- Around line 23-33: The captureNearBottom function uses
document.querySelector('[data-channel-scroll]') which can pick the wrong
container when multiple channels are mounted; update captureNearBottom (in
create-main-input-keyboard-handler / captureNearBottom) to query the scroll
element scoped to the current channel instance (e.g., use a channelRoot or
container element captured by the outer createMainInputKeyboardHandler factory
and call channelRoot.querySelector('[data-channel-scroll]') instead of
document.querySelector), keep the existing logic that computes
distanceFromBottom and sets wasNearBottom using NEAR_BOTTOM_THRESHOLD, and
ensure the outer factory receives/retains the correct channel root element so
the lookup is instance-scoped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 348713af-522d-4789-8314-a2dbd107a634

📥 Commits

Reviewing files that changed from the base of the PR and between e0f57d9 and 24a3ead.

📒 Files selected for processing (2)
  • js/app/packages/channel/Channel/Channel.tsx
  • js/app/packages/channel/Channel/create-main-input-keyboard-handler.ts

@peterchinman peterchinman merged commit 26f3a5c into main Apr 8, 2026
22 checks passed
@peterchinman peterchinman deleted the peter/scroll-channel-when-input-focused branch April 8, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant