scrollIntoView
scrollIntoView is a method on DOM elements that scrolls the nearest scrollable ancestor so that the element becomes visible within its scrolling container or the viewport. It is commonly used to reveal a target item, such as a newly added element, an error region, or a focused section, without requiring manual scrolling from the user.
The method can be called with a boolean alignToTop parameter (legacy) or with an options object. The
scrollIntoView scrolls only the nearest scrollable ancestor; if the element has no such ancestor, the call
Support is broad in modern browsers. In older environments, a polyfill or alternative scrolling logic may be