08:13
<annevk>
r? https://github.com/whatwg/whatwg.org/pull/440 & https://github.com/whatwg/whatwg.org/pull/441
08:41
<annevk>
krosylight: I think you can go ahead with https://github.com/whatwg/sg/issues/231 given that Tantek is presumably aware and okay with this?
11:19
<Jake Archibald>
Is there any guidance on when events should bubble? (for making platform-consistent events)
11:28
<annevk>
Jake Archibald: not that I know of. One consideration would be whether you want onX on a parent to get invoked.
11:32
<Jake Archibald>
annevk: yeah. I guess bubbling makes sense for 'click', since parent elements were also clicked. Whereas with the img load event, it's the image that loaded, none of the parents did.
11:32
<Jake Archibald>
cheers!
11:48
<sideshowbarker>
sideshowbarker: what happens in browsers?

I ended up rewriting the tests to remove the part that attempts to test “cancellation” of an edit operation — because as far as I can see, there is nothing in the spec to support that calling any event’s preventDefault() should cause any edit operation to be cancelled. And I couldn’t find that there was any way at all to cancel an edit operation.

And anyway, the test as written had not even been calling the edit operations themselves, but was instead just firing a textInput event with a particular input type, and relying on the fact that the implementation happened to be written to expect to get all the necessary data from that event.

The implementation of the textInput event had other properties beyond just what’s in the IDL and required by the spec. So the implementation had sort of just been using the event as a convenience to hang those other properties on. And that worked OK as long as the textInput event got fired prior to beforeinput — but not if the firing order of those events were changed.

But the event-firing order needed changing.

So I rewrote it all such that the code now instead passes on the actual data directly, and only puts what’s actually necessary into the textInput event (when it eventually gets fired later).

13:31
<zcorpan>
Jake Archibald: events fired on document generally bubble. UI events generally bubble, but not always (e.g. scroll on an element doesn't bubble)
13:32
<Jake Archibald>
zcorpan: It feels like that fits with what I said before. You're not scrolling parent elements, you're just scrolling that one element, so bubbling doesn't fit
13:39
<annevk>
Jake Archibald: you'll also have to consider if it gets retargeted on a shadow host, which is generally yes for UI events
14:34
<zcorpan>
Jake Archibald: yep, but then form submit bubbles, which doesn't seem to fit in. Also formdata, change, reset
14:35
<Jake Archibald>
zcorpan: hm, yeah. Are those seen as a historical mistake? Or is there just no real consistency?
14:40
<TabAtkins>
(I think most events should default to bubbling for ease of use, personally.)
14:40
<TabAtkins>
Every time I write a focus handler I have to cuss it for not working until I remember I have to capture it
14:56
<annevk>
Jake Archibald: in all my many years working in this space, I don't think anyone has ever articulated a coherent story around it
14:57
<annevk>
Jake Archibald: smaug or peterv might know one though
14:59
<smaug>
In some sense events which are expected to be used on the target itself shouldn't bubble. But yeah, it is all very inconsistent.
16:50
<annevk>
I wish more platforms had a nod reaction. At least to me that's quite different from thumbs up / +1 and nice to express.
16:51
<Domenic>
I can't remember why bubbling is even necessary, given that capturing exists...
16:53
<annevk>
In theory it's for post-target actions. And capture is for pre-target actions. It might have been interesting if where an event flows was entirely a function of listeners and not dispatch. (There was a semi-serious proposal for that at one point that I made, but it didn't gain traction.)
16:55
<annevk>
It's still up: https://github.com/whatwg/dom/issues/215
20:48
<smaug>
There used to be also the concept of event groups https://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Event-groups
20:51
<smaug>
from which Gecko got the concept of default and system groups. System group event listeners are in some cases used to implement activation behavior. (But system group gets its separate event phases after default group - so it is a bit different to the old event groups)