Re: [mediacapture-surface-control] Where do forwarded "wheel" events fire? (#51)

Got it! That means you're not firing the wheel event "at the `controller.[[source]]`'s viewport", but rather at **the element** in the `controller.[[source]]`'s viewport that would be targeted by the event if the wheel action had originated from that viewport.

In UI Events parlance, that element seems to be called the [topmost event target](https://w3c.github.io/uievents/#topmost-event-target). I would end the forward wheel event algorithm with "at the topmost event target of the controller.[[[Source]]](https://www.w3.org/TR/screen-capture/#dfn-source)'s viewport".

But I missed another problem (which probably also explains why I got confused): "fire an event" can only be triggered within an event loop. In your case, that event loop should be that of the captured viewport. Right now, the algorithm fires the event from within steps that run in parallel (so outside of any event loop) and in the context of the capturing viewport. That is doubly invalid.

The last step could perhaps be re-written to something like:

> 4. [Queue a global task](https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task) on [the user interaction task source](https://html.spec.whatwg.org/multipage/webappapis.html#user-interaction-task-source) of `controller.[[source]]`'s current realm, given that realm's [global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-realm-global), to [fire an event](https://dom.spec.whatwg.org/#concept-event-fire) named "wheel" using [WheelEvent](https://www.w3.org/TR/uievents/#wheelevent) with the [x](https://www.w3.org/TR/cssom-view-1/#dom-mouseevent-x) attribute initialized to scaledX, the [y](https://www.w3.org/TR/cssom-view-1/#dom-mouseevent-y) attribute initialized to scaledY, the [deltaX](https://www.w3.org/TR/uievents/#dom-wheelevent-deltax) attribute initialized to event.[deltaX](https://www.w3.org/TR/uievents/#dom-wheelevent-deltax) and the [deltaY](https://www.w3.org/TR/uievents/#dom-wheelevent-deltay) attribute initialized to event.[deltaY](https://www.w3.org/TR/uievents/#dom-wheelevent-deltay), at the [topmost event target](https://w3c.github.io/uievents/#topmost-event-target).

(I note the UI Events spec also has the notion of [wheel event transaction](https://w3c.github.io/uievents/#wheel-event-transaction) to group a series of wheel events that may be relevant when forwarding as well)

There may be an easier way to express "forward a UI event with the following coordinates" in simple terms. I haven't thought deeply about it, I was just confused because I did not understand where the event was supposed to fire ;)

-- 
GitHub Notification of comment by tidoust
Please view or discuss this issue at https://github.com/w3c/mediacapture-surface-control/issues/51#issuecomment-2546001987 using your GitHub account


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

Received on Monday, 16 December 2024 15:54:55 UTC