Skip to content
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

Add Scroll Snap events #24495

Merged
merged 2 commits into from
Oct 1, 2024
Merged

Conversation

chrisdavidmills
Copy link
Collaborator

Summary

Chrome 129 supports scroll snap events — scrollsnapchange and scrollsnapchanging, which enable code being fired in response to a new scroll snap target being snapped to, and the browser identifying a change in the next snap target to be snapped to (if the gesture were to end).

See the associated ChromeStatus entry and the Scroll Snap Events blog post for more context and a guide.

This PR adds the new events, and the SnapEvent event object.

Note: The spec defines the associated event handler properties as being defined on the GlobalEventHandlers mixin, but I've added the events to the Element object, as we no longer document GlobalEventHandlers. Let me know if you think it should sit somewhere else.

Test results and supporting details

Related issues

@github-actions github-actions bot added the data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Sep 23, 2024
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I defer to @queengooborg for whether Element is the right place for the events from the GlobalEventHandlers mixin.

@queengooborg
Copy link
Collaborator

For all mixins, we add the members to all the interfaces it applies to!

@chrisdavidmills
Copy link
Collaborator Author

OK, I've done some research and a bit of testing, and it looks like they are supported on Document and Window also. See also the spec mention here: https://drafts.csswg.org/css-scroll-snap-2/#event-handlers-on-elements-document-and-window-objects.

@queengooborg queengooborg merged commit 9a68821 into mdn:main Oct 1, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants