Skip to content

Conversation

@danxuliu
Copy link
Member

@danxuliu danxuliu commented Sep 26, 2019

Follow up to #1953

How to test

Scenario 1

  • Send a chat message of several lines

Scenario 2

  • Send several chat messages with different numbers of lines
  • Loop through the previous messages with arrow up/down

Scenario 3

  • Make the browser window narrow and reload the conversation
  • Type, without sending it, a message with several lines
  • Widen the browser window as much as possible
  • Type another character

Scenario 4

  • Start a call
  • Type, without sending it, a message with several lines
  • Leave the call
  • Type another character

Result with this pull request

The chat is kept at the same scroll position.

Result without this pull request

The chat jumps back.

When the new messsage field is cleaned after successfully sending a
message its height changes, so the stored height needs to be updated.
Otherwise when a keydown event is received again on the new message
field the old height would be used for the calculations, which would
cause the chat view to be wrongly scrolled after sending a message with
several lines.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Looping through the last messages on arrow up/down may change the height
of the new message field (as the last messages may contain different
numbers of lines), so this needs to be done before handling height
changes in the new message field for the chat view to be properly
scrolled.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
When the chat view is resized the new messsage field height may change,
so the stored height needs to be updated. Otherwise when a keydown event
is received again on the new message field the old height would be used
for the calculations, which would cause the chat view to be wrongly
scrolled if a message is currently in the new message field and its
height changed due to the resize.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu
Copy link
Member Author

/backport to stable17

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Works :)

@nextcloud nextcloud deleted a comment from danxuliu Sep 26, 2019
@nickvergessen nickvergessen merged commit e0cd1f9 into master Sep 26, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix-chat-jumping-back-when-typing-a-new-message branch September 26, 2019 07:54
@backportbot-nextcloud
Copy link

backport to stable17 in #2222

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.

3 participants