Re: [mediacapture-screen-share] Add configuration to chose whether or not to focus/bring to front the shared window display surface (#138)

At Firefox 76 `requestFullScreen()` can be used to _not_ focus on the captured application.

```

onclick = e => {
  onclick = null;
  navigator.mediaDevices.getDisplayMedia({video: true})
  .then(async stream => {
      await document.documentElement.requestFullscreen();
  });
}
```

That is, when an error is not thrown denying fullscreen access because `requestFullScreen()` is not called inside a short-running event handler. 


```
Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler.
TypeError: Fullscreen request denied
```

That occurred only twice out of at least 20 attempts, the first time not on purpose, the second time waiting an extra second before selecting the text editor application.

At Firefox 78 `requestFullscreen()` just throws an error

```
Request for fullscreen was denied because requesting element is not in the currently focused tab. firefox
TypeError: Fullscreen request denied
```

Focusing by default on the application that is a text editor has particular issues: it is not possible to regain focus on the document programmatically at that point. The cursor is in the text  editor application, not the `window` and not the `document`, resulting in `<input>.select()` and `<textarea>.focus()` and `opener.focus()` not working at all. Is that by design?

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

Received on Monday, 11 May 2020 01:53:09 UTC