[csswg-drafts] [cssom-view] Adding a "boundary" for scrollIntoView (#7792)

bakura10 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Adding a "boundary" for scrollIntoView ==
Hi,

Using scrollIntoView with the block/inline parameter is extremely nice as it allows to defer to the browser all the hard work of positioning, while having RTL support for free.

Unfortunately, one main issue with scrollIntoView is that it scrolls the whole page, making it unusable for a lot of our use case.

One typical use case we have is synchronizing elements: for instance, we have a carousel being hidden, but when a user change a selector, we want to adjust the selected slide, but _without_ scrolling back to the actual carousel.

This is however not possible, which forces us to re-implement all the complex logic of calculating positions for LTR and RTL, taking into account scroll-padding/margin, and feed the value to the "scrollTo" method, and also causing layout invalidation due to the calculations involved.

It would be nice if "scrollIntoView" would either support a boundary that would allow to control the scrolling area upon which the scroll must not be propagated (cf: https://github.com/stipsan/scroll-into-view-if-needed):

```
element.scrollIntoView({inline: 'start', behavior: 'smooth', boundary: scrollContainer});
```

Or extend the "scrollTo" element to support the same set of options:

```
element.scrollTo({inline: 'start', behavior: 'smooth'}); // Scroll to align the element, without scrolling the whole page
```

Thanks.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7792 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 25 September 2022 03:04:05 UTC