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; + } + } } });