Skip to content

Conversation

@Linhead
Copy link
Collaborator

@Linhead Linhead commented Oct 6, 2025

Description

Fixed incorrect scroll position adjustment in chat when closing mobile keyboard. The resizeHandler in AChat.vue was applying scroll correction regardless of viewport resize direction, causing the chat to scroll up ~4-5 messages when keyboard closes.

Changes:

  • Added condition clientHeightDelta > 0 to only adjust scroll when viewport shrinks (keyboard opens)
  • Preserved scroll position when viewport expands (keyboard closes)
  • Single-line change following Open-Closed principle for minimal regression risk

Related issue

Closes #886

Breaking changes

No

How to test

Prerequisites

  • Test on older Android device (Samsung A10/A11/A12/A13) or device with Chrome WebView < 108
  • Or use BrowserStack/similar service for older Android versions

Test Steps

Test Case 1: Basic keyboard close

  1. Open any chat dialog with 10+ messages
  2. Tap message input field to open keyboard
  3. Send 5 short text messages (e.g., "test 1", "test 2", etc.)
  4. Close keyboard by tapping on message area

Expected: Last sent message ("test 5") is visible at bottom
Actual before fix: Last message is hidden, need to scroll down manually

Test Case 2: Scrolling with keyboard open

  1. Open chat with 20+ messages
  2. Tap input field to open keyboard
  3. Scroll up to read older messages
  4. Close keyboard

Expected: Scroll position preserved at the same messages
Actual before fix: Scroll jumps up further, hiding more messages

Test Case 3: Rapid message sending

  1. Open chat dialog
  2. Tap input field
  3. Rapidly send 10 messages without closing keyboard
  4. Close keyboard

Expected: Last message visible
Actual before fix: Last ~4 messages hidden

Notes for reviewers

Highlight anything important that reviewers should pay attention to.
(e.g. tricky logic, potential side effects, performance considerations)

Checklist

  • Code is formatted
  • Tests added/updated (if needed) - no need
  • Documentation updated (if needed) - no need
  • Changes tested in all relevant environments - I could not reproduce it on my device

@Linhead Linhead requested a review from a team as a code owner October 6, 2025 15:43
@Linhead Linhead added the bug Something isn't working label Oct 6, 2025
@vercel
Copy link

vercel bot commented Oct 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
adamant-im Ready Ready Preview Comment Oct 6, 2025 3:43pm

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

Deployed to https://msg-adamant-pr-887.surge.sh 🚀

@metalisk
Copy link
Member

metalisk commented Oct 8, 2025

primarily older Android devices like Samsung A12

I propose ignoring (especially) not critical bugs on old devices to be more effective and not to maintain legacy.

If this bug affects only old devices, and fix doesn't work, let's close the issue without a solution.

@metalisk metalisk added the UX/UI User interface and experience improvements label Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working UX/UI User interface and experience improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Last N messages not visible after hiding keyboard on media message

4 participants