Re: [csswg-drafts] [cssom-view-1] Scroll methods in Element and Window return Promises (#12355)

Below are my responses, sorry for the delay (I was on vacation for several weeks).

> The boolean stuff is rather confusing. Do we want / is it worth resolving differently for completion vs interruption? Can't stuff technically scroll after the UA resolves the promise, kinda defeating the point of it?

@emilio I agree the [original resolution](https://github.com/w3c/csswg-drafts/issues/1562) does not include such details, and in our first patch we had the IDL type `Promise<undefined>`.  But we found the spec language "resolve a Promise with true/false" far more expressive than "resolve a Promise (with nothing)".  Moreover, this little addition gives the developers as easy way to test a successful call:
```
let scrolled = await elem.scrollBy(10);
```

I think we correctly prevented the possibility of scrolling after promise resolution through the last few steps in our [#perform-a-scroll](https://drafts.csswg.org/cssom-view/#perform-a-scroll) algorithm.  Note that all other scroll algorithms ultimately [rely on this one](https://drive.google.com/file/d/1QLYGrCwylU7mhwdQIrXIXnSFFZCDFfaG/view), and they never resolve any promise with true unless the innermost call does the same.

Please correct me if I missed any call dependency in the spec!

> 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?

@dlrobertson: When multiple scrollers are involved, writing a `scrollend` event based promise is non-trivial.  For example, it is not easy to determine which elements would be affected by the call `elem.scrollIntoView()`, and then wait for all of them to emit `scrollend` events.

-- 
GitHub Notification of comment by mustaqahmed
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/pull/12355#issuecomment-3246661511 using your GitHub account


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

Received on Tuesday, 2 September 2025 20:16:28 UTC