Re: [mediacapture-screen-share] A CaptureController object for getDisplayMedia() (#230)

> Regarding timer, with `focus()` it's simpler: no concern over delaying a default action. The window simply won't be focused past some time.

This appears to be the main remaining open issue. Let's tackle it. I'll explain my position again.

* Timers always produce flakiness. That's a **necessary evil** and we'll live with it. But it's still evil, so we should minimize it.
* Code that calls `setFocusBehavior()` sooner will be less flaky than code that calls `setFocusBehavior()` later. We should **strongly encourage** developers to call `setFocusBehavior()` ASAP.
* The task-based window-of-opportunity presented [here](https://github.com/w3c/mediacapture-screen-share/issues/230#issuecomment-1238184221) does that. Consider some flakiness-prone patterns like doing communication with a remote server to determine whether to focus, or posting a task to do one more thing and then call `setFocusBehavior()`.
   * With only a timer, these will work 99% of the time, and developers might come to employ them. ("Works 100% of the time on my setup.")
   * With a timer **and** the task-closing-WOO, they will work 0% of the time, forcing developers to rely on better patterns instead.
* **Users** will benefit from developers never taking the flakier route.

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


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

Received on Thursday, 8 September 2022 07:50:57 UTC