https://notesontech.com/javascript-scroll-if-needed/
How to scroll to an element only if needed (using JavaScript)