-
Notifications
You must be signed in to change notification settings - Fork 716
[cssom-view] Fire scrollend consistently in cases where there is no scrolling. #8218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Though if we make the scrolling APIs (scrollIntoView, scrollIntoViewIfNeeded, scrollTo, etc) return promises which resolve when the scroll is complete I could see never firing scrollend if there is no scroll. I'm not sure whether the current spec text is clear on what the behavior should be to the current text,
This could be interpreted either way I think. |
In fact, on further reflection I strongly prefer scrollend strongly paired to scroll events, and developers relying on promises for scroll apis. So TLDR:
|
I feel like keeping the problem space of this issue seems to be "it's hard to know that no scrolling occurred after programmatic assignment" and I think that problem lives at a higher level than |
what kind of updates would reduce ambiguity for you? have suggestions 🙂 |
So there is a note that calls this out that no scrolling produces no scrollend, but if I read the normative text from https://drafts.csswg.org/cssom-view/#scrolling it sounds as if scrollend is always emitted. I.e. taking the instant case (because it's simpler), the following steps must be run:
This needs normative text to say something like if the scroll position was not originally "position" then emit a scrollend event. |
I just tested out adding some of this additional copy,and it sounds repetitive while also having the note directly following the new copy about not emitting the event if no translation occurred. I'm worried it'll clutter and repeat the copy instead of make it clearer. The spec starts to sound really concerned you'll not see the note. Thoughts? maybe adding more tests for these cases is better than copy edits? |
this still relevant you feel or covered via updates since this issue was created? |
I still think the normative text is wrong. What if we add a step before step 2 after the abort in step 1 that says if the box is already scrolled to position, abort the remaining steps? This would be similar to step 3 in the procedure to scroll to the beginning of the document |
This seems like this would be solved by #8397 |
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.
@argyleink
The text was updated successfully, but these errors were encountered: