From 04ede15c8855565dee5d7f3ae4be5c76a879d96d Mon Sep 17 00:00:00 2001 From: Youenn Fablet Date: Tue, 28 Mar 2023 11:45:10 +0200 Subject: [PATCH] Update how FocusChangeDisabled is set to true in case of change of focus. The change covers potential race conditions where the change of focus task is already enqueued at the time the getDisplayMedia promise is resolved. Add a note to talk about the requirement behind these steps and that it should apply to any type of picker, whether user agent level or OS level. --- index.html | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index fe0cf0b..7d810a8 100644 --- a/index.html +++ b/index.html @@ -423,6 +423,24 @@

abort these steps.

+
  • +

    If the current settings object's's [=relevant global object=]'s [=associated Document=]'s + [=top-level browsing context=] is losing focus, + queue a global task on the user interaction task source + given current settings object's [=relevant global object=] to run the following step: +

      +
    1. Set controller.{{CaptureController/[[FocusChangeDisabled]]}} to true.

    2. +
    +

    +

    + These steps ensure {{CaptureController}} will not override explicit focus actions made by the user, + typically if a user decides to switch to another surface shortly after starting capture. + This algorithm describes what to do for surface pickers implemented by the user agent but the same + requirement applies to surface pickers implemented outside of the user agent, + where the loss of capturing document focus is not necessarily the signal triggering setting + {{CaptureController/[[FocusChangeDisabled]]}} totrue. +

    +
  • Permission Failure: [=Reject=] p with a new {{DOMException}} @@ -435,23 +453,6 @@

    Return p.

  • -

    - When the top-level document loses focus, run the following steps on all - {{CaptureController}} objects in that document and in documents of its nested - [=browsing contexts=]: -

    -
      -
    1. -

      - If {{CaptureController/[[Source]]}} is undefined, abort these steps. -

      -
    2. -
    3. -

      - Set {{CaptureController/[[FocusChangeDisabled]]}} to true. -

      -
    4. -

    The user agent MUST NOT capture content that's behind a partially transparent captured display surface.