#1105: ScrollIntoViewOptions container attribute

Visit on Github.

Opened May 30, 2025

こんにちは TAG-さん!

I'm requesting a TAG review of the ScrollIntoViewOptions container attribute.

There are many advantages of using scrollIntoView, it is an ergonomically simple way for a developer to request that a particular element is made visible, aligning it within the scroll padding of the scroller and snapping as appropriate.

However, in many circumstances it can be counter-intuitive that a scroll into view call scrolls all ancestor scrollers. E.g. If a slideshow or carousel uses a scrolling box for slides and uses scrollIntoView to advance to the next slide, this will also force the top level scroller to scroll the slideshow into view.

The container attribute on the ScrollIntoViewOptions dictionary allows a developer to use scrollIntoView without forcibly scrolling all of the ancestor scrolling containers.

This demo uses the API to show how it helps in practice.

Further details:

Discussions

Discussed Jun 9, 2025 (See Github)

Jeffrey: DanC drafted a comment; we can post.

Discussed Jun 23, 2025 (See Github)

Jeffrey: Suggest satisfied with a comment that it'd be really nice if the specification included a description of the use case and some example code.

Jeffrey: The explainer and spec has no intro section. Will suggest satisfied but with that request.