Open
Description
While experimenting with the implementations of scrollend in firefox and chrome I noticed that there's some inconsistency about in which cases it fires when no scrolling occurs. In particular, scrollend is fired when the user pressed an arrow key, or performs a scrolling action which results in no scroll, but is not fired when a programmatic API is used to scroll to the current location.
While I can see an ergonomic argument for strictly pairing scrollend to scroll events, I think it would be useful if we guaranteed a scrollend event will occur after scrolling API calls, enabling developers to do something after a scroll to a location without needing to detect if scroll didn't happen. e.g.
function scrollToPromise(element) {
return new Promise((resolve) => {
window.addEventListener('scrollend', resolve);
element.scrollIntoViewIfNeeded();
});
}