scroll-into-view-if-needed icon indicating copy to clipboard operation
scroll-into-view-if-needed copied to clipboard

Unneeded scrolling of ancestors

Open hyvyys opened this issue 6 years ago • 1 comments

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").

hyvyys avatar Sep 25 '19 15:09 hyvyys

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'),
});

owaiswiz avatar Dec 29 '23 16:12 owaiswiz