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

In January 2023, an article was published on Google Chrome blog https://developer.chrome.com/blog/scrollend-a-new-javascript-event/

And now we have new`onscrollend` event. Here is the function to scroll into view and wait for scroll end:
```js
function scrollIntoViewAndWait(element) {
    return new Promise(resolve => {
        document.addEventListener('scrollend', resolve, {once: true});

        element.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});
    });
}
```

[Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Document/scrollend_event#browser_compatibility)

-- 
GitHub Notification of comment by alex-bacart
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3744#issuecomment-1806865249 using your GitHub account


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

Received on Saturday, 11 November 2023 16:59:07 UTC