From bb468e7b01e3e72d4f5c93a3cfae737a5e67f0ac Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 19 May 2017 14:45:40 -0700 Subject: [PATCH] Wait for scroll before deciding whether to add scroll down button FREEBIE --- js/views/conversation_view.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 725c1647f9..e802ac4188 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -278,9 +278,13 @@ unreadEl.insertBefore(this.$('#' + oldestUnread.get('id'))); var position = unreadEl[0].scrollIntoView(true); - if (this.view.bottomOffset > 0) { - this.addScrollDownButtonWithCount(unreadCount); - } + // scrollIntoView is an async operation, but we have no way to listen for + // completion of the resultant scroll. + setTimeout(function() { + if (this.view.bottomOffset > 0) { + this.addScrollDownButtonWithCount(unreadCount); + } + }.bind(this), 1); } },