- From: Michaël Gallego via GitHub <sysbot+gh@w3.org>
- Date: Wed, 11 Oct 2023 05:24:39 +0000
- To: public-css-archive@w3.org
Hi, I am Michael from Twitter. The `scrollIntoView` API has indeed be problematic for us since the start, and most of the use cases where I wanted to use it, I could not because of the full page scroll. I have developed a scroll-snap based carousel and due to our constraints (we are creating Shopify themes) we have to support a lot of different scenario: various alignments (start, end, center), support for scroll-margin/padding, taking into account borders, full support for RTL... All of this is possible by using scrollTo and manually calculating the offset, but it quickly becomes extremely complex (especially RTL, where things like scroll offsets behave very strange). Having a way to simply reuse scrollIntoView and making sure the scroll does not propagate to the whole page would help to remove ton of code, and also make it much more robust. Lately, I started using this library (https://github.com/scroll-into-view/compute-scroll-into-view) to calculate all the offset (I recently pushed a PR to add RTL support and it was messy) and apply scrollTo, and I really like the `boundary` setting, I think it could be used in a similar way: ``` slideCell.scrollIntoView({ inline: 'start', boundary: carousel }); ``` By doing this, the scroll will propagate until the carousel itself and stop there. This is by far the most flexible approach and would fix all my grips with scrollIntoView :D. -- GitHub Notification of comment by bakura10 Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9452#issuecomment-1756829797 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 11 October 2023 05:24:41 UTC