- From: Dan Robertson via GitHub <noreply@w3.org>
- Date: Mon, 04 Aug 2025 14:23:47 +0000
- To: public-css-archive@w3.org
What is the relation of this new scroll promise to the [`scrollend`](https://drafts.csswg.org/cssom-view/#eventdef-document-scrollend) event? And are there reasons to use one over the other?
FWIW `scrollend` happens to be in [interop 2025](https://wpt.fyi/interop-2025). The original issue https://github.com/w3c/csswg-drafts/issues/1562 states a need to do the following:
```js
let element = document.getElementById('scroll-container');
element.scroll(0, 400).then(() => {
// ...scroll has finished
});
```
After interop 2025 completes, the following or something like it should be relatively reliable.
```js
let element = document.getElementById('scroll-container');
let scrollPromise = new Promise(resolve => element.addEventListener("scrollend", resolve, {once: true}));
element.scroll(0, 400);
scrollPromise.then(() => {
// ...scroll has finished
});
```
--
GitHub Notification of comment by dlrobertson
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/pull/12355#issuecomment-3150940799 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 4 August 2025 14:23:48 UTC