Merge pull request #6673 from akathuria289/scroll_activate

Fixed issue #6394
This commit is contained in:
Jitendra Singh 2022-09-07 12:37:34 +05:30 committed by GitHub
commit 41fb2837a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

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