[csswg-drafts] [cssom-view-1] Provide onAnimationEnd callback in scrollIntoView options (#3744)

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

== [cssom-view-1] Provide onAnimationEnd callback in scrollIntoView options ==
[Spec](https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview)

Right now you can't really tell if `scrollIntoView` scroll animation has finished nor you can't control the speed of the scroll and it might differ with each browser. So if you want to perform some action right after the animation has finished there's no determined way to do that. Having an `onAnimationEnd` callback as an initializer option would solve this problem:

```javascript
Element.scrollIntoView({
  onAnimationEnd: () => Element.focus()
})
```


**Why we would ever need that?**

Imagine that you have some input you would like to focus that's out of the viewport boundaries right now, but you would also like to have a smooth scrolling animation to that input. If you execute `focus` before `scrollIntoView` then you'll get no scroll animation, because browser will 
already scroll to that input without animation.

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

Received on Tuesday, 19 March 2019 12:18:50 UTC