code: function scrollIntoViewport( element ) {
  	const elementStartY = recursivelyWalkAndSum( element, 'offsetTop', 'offsetParent' ),
  		elementEndY = elementStartY + element.offsetHeight;
  	if ( isInViewportRange( elementStartY, elementEndY ) ) {
  		return;
  	}
  
  	try {
  		window.scroll( {
  			top: elementStartY,
  			left: 0,
  			behavior: 'smooth',
  		} );
  	} catch ( e ) {
  		window.scrollTo( 0, elementStartY );
  	}
  }
docs: Scroll an element into the viewport if it's not already inside the viewport
  @param {HTMLElement} element