diff --git a/NEWS b/NEWS index e7a631719..0b68f80d7 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ Bug fixes - [web] improved detection of URLs and email addresses in text mail parts - [web] fixed page reload with external IMAP account (#4709) - [web] constrained absolute-positioned child elements of HTML mail parts + - [web] fixed useless scrolling when deleting a message - [core] allow super users to modify any event (#4216) - [core] correctly handle the full cert chain in S/MIME - [core] handle multidays events in freebusy data diff --git a/UI/WebServerResources/js/Mailer/MessageController.js b/UI/WebServerResources/js/Mailer/MessageController.js index bfc6e6b0c..ed3eced18 100644 --- a/UI/WebServerResources/js/Mailer/MessageController.js +++ b/UI/WebServerResources/js/Mailer/MessageController.js @@ -314,7 +314,8 @@ this.deleteMessage = function() { var mailbox, message, state, nextMessage, previousMessage, - parentCtrls = $parentControllers(); + parentCtrls = $parentControllers(), + $timeout = this.service.$timeout; if (parentCtrls.messageCtrl) { mailbox = parentCtrls.mailboxCtrl.selectedFolder; @@ -360,10 +361,12 @@ state.go('mail.account.virtualMailbox.message', {mailboxId: encodeUriFilter(nextMessage.$mailbox.path), messageId: nextMessage.uid}); else state.go('mail.account.mailbox.message', {messageId: nextMessage.uid}); - if (nextIndex < mailbox.$topIndex) - mailbox.$topIndex = nextIndex; - else if (nextIndex > mailbox.$lastVisibleIndex) - mailbox.$topIndex = nextIndex - (mailbox.$lastVisibleIndex - mailbox.$topIndex); + $timeout(function() { + if (nextIndex < mailbox.$topIndex) + mailbox.$topIndex = nextIndex; + else if (nextIndex > mailbox.$lastVisibleIndex) + mailbox.$topIndex = nextIndex - (mailbox.$lastVisibleIndex - mailbox.$topIndex); + }); } else { state.go('mail.account.mailbox').then(function() {