From 60d3ca54659b8cdc72e9d07af5b2d4ceb055ba0e Mon Sep 17 00:00:00 2001 From: Abhishek Kathuria Date: Tue, 30 Aug 2022 18:56:11 +0530 Subject: [PATCH] Fixed issue #6394 --- .../views/shop/products/view.blade.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php index 229f91d6f..52be5e83b 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php @@ -289,9 +289,35 @@ setTimeout(function() { document.getElementById('product-form').submit(); }, 0); + } else { + this.activateAutoScroll(); } }); }, + + activateAutoScroll: function(event) { + + /** + * This is normal Element + */ + const normalElement = document.querySelector( + '.control-error:first-of-type' + ); + + /** + * Scroll Config + */ + const scrollConfig = { + behavior: 'smooth', + block: 'end', + inline: 'nearest', + } + + if (normalElement) { + normalElement.scrollIntoView(scrollConfig); + return; + } + } } });