Scrolls container just enough to reveal child — scrollIntoView({ block: 'nearest' }), confined
to one scroller.
Use this, not scrollIntoView, to keep a list's selected row visible. scrollIntoView also scrolls
every scrollable ancestor, including the page, so a list inside a popup can drag the whole document to
wherever the popup happens to be.
Where the browser supports scrollIntoView({ container: 'nearest' }) that is used directly; container
must then be child's nearest scrollable ancestor.
Parameters
container: HTMLElement
The scrolling element.
child: HTMLElement
The element to reveal.
behavior: ScrollBehavior = 'auto'
Instant or smooth scrolling. Defaults to the container's scroll-behavior.
Scrolls
containerjust enough to revealchild—scrollIntoView({ block: 'nearest' }), confined to one scroller.Use this, not
scrollIntoView, to keep a list's selected row visible.scrollIntoViewalso scrolls every scrollable ancestor, including the page, so a list inside a popup can drag the whole document to wherever the popup happens to be.Where the browser supports
scrollIntoView({ container: 'nearest' })that is used directly;containermust then bechild's nearest scrollable ancestor.