From 6a611cbecf28487be35148de807fdea4af0d26a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Beaup=C3=A8re?= Date: Thu, 5 Jul 2018 18:52:24 +0200 Subject: [PATCH] Auto-scroll to selected conversation when reordering them (#2498) When conversations are reordered (last message time has changed), this commit leads to scrolling the shortest distance to the conversation. --- js/views/conversation_list_view.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/views/conversation_list_view.js b/js/views/conversation_list_view.js index daaa9b995..b46a43dbb 100644 --- a/js/views/conversation_list_view.js +++ b/js/views/conversation_list_view.js @@ -47,6 +47,12 @@ var target = this.$('.' + targetConversation.cid); $el.insertAfter(target); } + + if ($('.selected').length) { + $('.selected')[0].scrollIntoView({ + block: 'nearest', + }); + } }, removeItem: function(conversation) { var $el = this.$('.' + conversation.cid);