standards-positions
standards-positions copied to clipboard
ScrollIntoViewOptions container attribute
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.