From 35f7747fd853a90b3c9316c13f6da9ce62dc41ec Mon Sep 17 00:00:00 2001 From: yolouiese Date: Wed, 9 Sep 2020 02:37:06 +0800 Subject: [PATCH] magento/adobe-stock-integration#1801: User is not scrolled up to the Login failed. Please check if the Secret Key... error, and can miss the message - modified scroll to top script --- .../view/adminhtml/web/js/grid/columns/image.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js index bf852d0ddae68..4ff8eb36114d0 100644 --- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js +++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js @@ -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', @@ -270,6 +272,7 @@ define([ */ addMessage: function (code, message) { this.messages().add(code, message); + this.scrollToMessageContent(); this.messages().scheduleCleanup(); }, @@ -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' + }); } }); });