fix[ios channels]: scroll message list when input focused"#2452
fix[ios channels]: scroll message list when input focused"#2452peterchinman merged 4 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughIntroduces 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
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
js/app/packages/channel/Channel/Channel.tsxjs/app/packages/channel/Channel/create-main-input-keyboard-handler.ts
on iOS we need to scroll the message list, when the user is near the bottom, when the main input is focused.