Re: [mediacapture-screen-share] Conditional Focus (When Display-Capture Starts) (#190)

> > By scheduling another task, the risk is to further delay the decision.
> 
> Why are we in fear of queuing a task? Have you measured this?

As per spec, additional events or JS callbacks are potentially called, plus potentially other tasks in between the two tasks.
The more we call web app JS, the more delay there is.
Getting a synchronous decision in that particular case seems good, just like being able to prevent default actions for input events is happening synchronously.

> > This might lead to potential flakinesses or subtle interop issues.
> 
> What evidence do you have of this?

Spec says in https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model.
`Let taskQueue be one of the event loop's task queues, chosen in an implementation-defined manner, with the constraint that the chosen task queue must contain at least one runnable task. If there is no such task queue, then jump to the microtasks step below`

`For example, a user agent could have one task queue for mouse and key events (to which the user interaction task source is associated), and another to which all other task sources are associated. Then, using the freedom granted in the initial step of the event loop processing model, it could give keyboard and mouse events preference over other tasks three-quarters of the time, keeping the interface responsive but not starving other task queues.`

> No I want to queue a task.

Do you have a good example of an existing API where we queue a task in a similar scenario as this one where UA needs to wait for some JS to do a default UI action?

> No I want to queue a task.

Why is queuing a task better than the specific Microtask approach I mentioned?

-- 
GitHub Notification of comment by youennf
Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/190#issuecomment-929526190 using your GitHub account


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

Received on Tuesday, 28 September 2021 18:42:47 UTC