standards-positions icon indicating copy to clipboard operation
standards-positions copied to clipboard

ScrollIntoViewOptions container attribute

Open flackr opened this issue 4 months ago • 0 comments

WebKittens

No response

Title of the proposal

ScrollIntoViewOptions container attribute

URL to the spec

https://drafts.csswg.org/cssom-view/#dictdef-scrollintoviewoptions

URL to the spec's repository

https://github.com/w3c/csswg-drafts

Issue Tracker URL

No response

Explainer URL

https://github.com/w3c/csswg-drafts/issues/9452

TAG Design Review URL

https://github.com/w3ctag/design-reviews/issues/1105

Mozilla standards-positions issue URL

https://github.com/mozilla/standards-positions/issues/1237

WebKit Bugzilla URL

No response

Radar URL

No response

Description

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.

flackr avatar May 30 '25 15:05 flackr