scroll-into-view-if-needed
scroll-into-view-if-needed copied to clipboard
Unneeded scrolling of ancestors
https://recordit.co/z3vQ93V1YP
Scrolling the parent also scrolls another ancestor higher up the DOM tree.
I understand this is the "standard" behavior even for the browser-implemented scrollIntoView. Is there any way to prevent this? It would be useful if the method did what its name suggest ("ifNeeded").
This might've been added after you opened this PR, but I see there's a boundary option now, which might solve the issue:
scrollIntoView(node, {
behavior: 'smooth',
block: 'end',
boundary: document.getElementById('example-boundary'),
});