demo · v138

scrollIntoView({ container: "nearest" })

A nested scroller inside a scroller. Click "scrollIntoView" with each option. With container: "nearest" only the inner scroller moves to reveal the target. With the default "all", both the inner and outer scrollers move.

checking support…
↑ outer scroller (this whole grey box scrolls)
↓ outer scroller continues
outer scrollTop: 0px · inner scrollTop: 0px

the code

// 138+: limit scrolling to the nearest scroller only.
target.scrollIntoView({
  block: "center",
  container: "nearest", // NEW: don't disturb ancestors
});

see also