Skip to content

Snapevents #1522

@hvanops

Description

@hvanops

Specification

Spec review for Snap Events · Issue #943 · w3ctag/design-reviews · GitHub

Description

Snap Events allow developers to reliably listen for when the "snap target" of a scroller changes and perform style adjustments as desired.

CSS scroll snap points are often used as a mechanism to create scroll interactive "selection" components, where selection is determined with javascript intersection observers and a scroll end guesstimate. By creating built-in events, the invisible state will become actionable, at the right time, and always correct. This feature adds two JavaScript events:

  • Snapchanging: This event gives developers a hint during a scroll operation that the user agent intends to snap the scroll container to a new snap target based on the scrolling input so far.

  • Snapchanged: This event lets developers know that the element to which a scroller is snapped has changed, and fires at the completion of a scroll operation (including snapping)

Browser support

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature definitionCreating or defining new features or groups of features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions