I want a comprehensive scrolling API

Submitted by ExtAnimal

This idea is currently being discussed.

The scrollIntoView API has the block and inline settings which tell it where in the scrolling viewport the target element should be scrolled, 'start', 'center' etc. And has behavior smooth. But that is not enough for real world use cases.

You may want "space" round the target element rather than when scrolling to block : 'start' having the top touch the top of the viewport.

If the target is extremely large, you may need to ask for just the top 200 pixels of it to move into view.

And finally... Of course it should yield a Promise which resolves when the smooth scrolling has settled and the layout is in its final shape.

I have an issue outstanding: https://github.com/w3c/csswg-drafts/issues/9836

Also, it does not handle sticky elements which occlude the target part of the viewport.

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

Tagged
JavaScript Dom Api
Votes
0
What are votes for and how are they tallied?