- From: Robert Flack via GitHub <sysbot+gh@w3.org>
- Date: Tue, 10 Oct 2023 16:51:43 +0000
- To: public-css-archive@w3.org
flackr has just created a new issue for https://github.com/w3c/csswg-drafts: == [cssom-view-1] Provide option for scrollIntoView that only scrolls a single scroll container. == The [scrollIntoView](https://www.w3.org/TR/cssom-view-1/#dom-element-scrollintoview) API invokes the behavior to [scroll an element into view](https://www.w3.org/TR/cssom-view-1/#scroll-an-element-into-view) which: > means to run these steps for each ancestor element or [viewport](https://www.w3.org/TR/cssom-view-1/#viewport) that establishes a [scrolling box](https://www.w3.org/TR/cssom-view-1/#scrolling-box) scrolling box, in order of innermost to outermost [scrolling box](https://www.w3.org/TR/cssom-view-1/#scrolling-box) However, in many circumstances it can be counter-intuitive that a scroll into view call scrolls 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. This is often surprising, especially when scrollIntoView is used as a convenience to automatically calculate the scroll position rather than using scrollTo on the scroller. @argyleink has examples where this has been problematic. As such, I propose we add the ability to scroll an element into view that only scrolls the nearest scrolling box. There are two ways to do this: 1. Add an option to [ScrollIntoViewOptions](https://www.w3.org/TR/cssom-view-1/#dictdef-scrollintoviewoptions), e.g. `scroll = "nearest" | "ancestors"` with a default of `ancestors` (happy to bikshed names), or 2. Add the necessary options to [ScrollToOptions](https://www.w3.org/TR/cssom-view-1/#dictdef-scrolltooptions) to scroll a particular element into view. E.g. we could provide a `target` and alignment options (similar to ScrollIntoViewOptions). It would be hard to define reasonable interactions when for example a target is specified and a left value is specified. Further, it would be odd when there is an intermediate scroller that does not have the element visible, do we scroll to where the element is outside of the intermediate scroller's scrollport or do we scroll to the intermediate scroller? I think option 1 is simpler and a reasonable api. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9452 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 10 October 2023 16:51:44 UTC