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
  • Loading branch information
gabrieldagama authored Sep 10, 2020
2 parents 4003ee5 + 5541522 commit f878232
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 f878232

Please sign in to comment.