[csswg-drafts] [css-scroll-snap-2] Should snap events fired at the document bubble? (#10173)

DavMila has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-scroll-snap-2] Should snap events fired at the document bubble? ==
The scroll-snap-2 spec says that snap events ("snapchanged" & "snapchanging") [should not bubble](https://drafts.csswg.org/css-scroll-snap-2/#:~:text=A%20SnapEvent%20should%20not%20bubble).

For snap events targeted at the document, this diverges from the behavior specified for scroll events which [should bubble](https://www.w3.org/TR/cssom-view-1/#:~:text=If%20target%20is%20a%20Document,%20fire%20an%20event%20named%20scroll%20that%20bubbles%20at%20target) when targeted at the document. I believe the effect of bubbling when targeted at the document is that scroll events can also be listened to on the window.

Making snap events behave consistently with scroll events in this regard may be closer to developers' expectations since it is not uncommon for developers to listen for scrolls on a page via

`window.addEventListener("scroll", () => {/* Do Stuff.*/})` or `window.onscroll = () => {/* Do Stuff. */}`

A developer might expect to be able to write

`window.addEventListener("snapchanged", () => {/* Do Stuff.*/})`

just as they would

`document.addEventListener("snapchanged", () => {/* Do Stuff.*/})`

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10173 using your GitHub account


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

Received on Wednesday, 3 April 2024 19:25:06 UTC