From 6dcafb5b2cb870cbd0659600d1f6d21bdaaccd01 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 15 Jan 2016 07:30:08 +0000 Subject: [PATCH] Don't scroll down on event notifications (when user manually scrolled up). Updates #352 --- converse.js | 5 ++++- docs/CHANGES.md | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/converse.js b/converse.js index eadeee2f5..b5ef10d9b 100644 --- a/converse.js +++ b/converse.js @@ -1420,8 +1420,11 @@ if (!keep_old) { this.clearStatusNotification(); } + var was_at_bottom = this.$content.scrollTop() + this.$content.innerHeight() >= this.$content[0].scrollHeight; this.$content.append($('
').text(message)); - this.scrollDown(); + if (was_at_bottom) { + this.scrollDown(); + } }, clearChatRoomMessages: function (ev) { diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 368793acb..84383dacf 100644 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -2,6 +2,8 @@ ## 0.10.1 (Unreleased) +- #352 When the user has manually scrolled up in a chat window, don't scroll + down on chat event notifications. [jcbrand] - #524 Added `auto_join_on_invite` parameter for automatically joining chatrooms. [ben] - #521 Not sending presence when connecting after disconnection. [jcbrand] - #536 Presence not sent out (in cases where it should) after page refresh. [jcbrand]