Extend the getDisplayMedia() API by adding a CaptureController object which can be passed in as a parameter. This object exposes a setFocusBehavior() method. By calling this method, an app can control whether the captured tab/window is focused when capture starts, or whether the capturing page should retain focus.
Consider a video-conferencing Web-application capturing another tab/window. When the capture is initiated, the active tab and window are those in which the VC application is running. Should the browser activate the captured tab/window instead? It depends. Let’s examine the hypothetical example of a video-conferencing application called VC3000. * If the captured source is an interactive page like a text editor, VC3000 believes it best to switch focus immediately, allowing the user to control it directly. * If the captured application is a remote-controllable application (using Capture Handle to establish the connection), then VC3000 believes it best to retain focus, because it can expose user-controls in itself and allow the user to interact with the captured tab without ever leaving VC3000. For example, if capturing a presentation, VC3000 might expose previous/next-slide controls. The application wants to control whether focus moves to the captured application when the capture starts. The user also benefits from this decision’s delegation, so long as it can be done safely.
Docs: https://docs.google.com/document/d/1LHJRt-ry9hwzFTbPxKrmD0VvtEFEU6lvqsD7k6wwGKM
Samples: https://wicg.github.io/conditional-focus/demo
Explainers: https://github.com/WICG/conditional-focus/blob/main/README.md