Skip to content

Commit

Permalink
ENGCOM-8166: #1801: User is not scrolled up to the 'Login failed. Ple…
Browse files Browse the repository at this point in the history
…ase check if the Secret Key...' error, and can miss the message #29947

 - Merge Pull Request #29947 from yolouiese/magento2:1801-user-is-not-scrolled-up-to-error-message
 - Merged commits:
   1. 35f7747
  • Loading branch information
magento-engcom-team committed Sep 9, 2020
2 parents 20b7e0d + 35f7747 commit 5541522
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ define([
return Column.extend({
defaults: {
bodyTmpl: 'Magento_MediaGalleryUi/grid/columns/image',
messageContentSelector: 'ul.messages',
mediaGalleryContainerSelector: '.media-gallery-container',
deleteImageUrl: 'media_gallery/image/delete',
addSelectedBtnSelector: '#add_selected',
deleteSelectedBtnSelector: '#delete_selected',
Expand Down Expand Up @@ -270,6 +272,7 @@ define([
*/
addMessage: function (code, message) {
this.messages().add(code, message);
this.scrollToMessageContent();
this.messages().scheduleCleanup();
},

Expand All @@ -284,6 +287,20 @@ define([
!this.massaction().massActionMode()) {
this.deselectImage();
}
},

/**
* Scroll to the top of media gallery page
*/
scrollToMessageContent: function () {
var scrollTargetElement = $(this.messageContentSelector),
scrollTargetContainer = $(this.mediaGalleryContainerSelector);

scrollTargetContainer.find(scrollTargetElement).get(0).scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'nearest'
});
}
});
});

0 comments on commit 5541522

Please sign in to comment.