Skip to content

Commit

Permalink
Update how FocusChangeDisabled is set to true in case of change of fo…
Browse files Browse the repository at this point in the history
…cus.

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.
  • Loading branch information
youennf committed Mar 28, 2023
1 parent 690709a commit 04ede15
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,24 @@ <h2>
abort these steps.
</p>
</li>
<li>
<p>If the <a>current settings object</a>'s's [=relevant global object=]'s [=associated Document=]'s
[=top-level browsing context=] is losing <a data-cite="!HTML/#gains-focus">focus</a>,
queue a global task on the <a data-cite="!HTML/#user-interaction-task-source">user interaction task source</a>
given <a>current settings object</a>'s [=relevant global object=] to run the following step:
<ol>
<li><p>Set <var>controller</var>.{{CaptureController/[[FocusChangeDisabled]]}} to <code>true</code>.</p></li>
</ol>
</p>
<p class="note">
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 <a>user agent</a> but the same
requirement applies to surface pickers implemented outside of the <a>user agent</a>,
where the loss of capturing document focus is not necessarily the signal triggering setting
{{CaptureController/[[FocusChangeDisabled]]}} to<code>true</code>.
</p>
</li>
<li>
<p><em>Permission Failure</em>: [=Reject=]
<var>p</var> with a new {{DOMException}}
Expand All @@ -435,23 +453,6 @@ <h2>
<p>Return <var>p</var>.</p>
</li>
</ol>
<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=]:
</p>
<ol>
<li>
<p>
If {{CaptureController/[[Source]]}} is <code>undefined</code>, abort these steps.
</p>
</li>
<li>
<p>
Set {{CaptureController/[[FocusChangeDisabled]]}} to <code>true</code>.
</p>
</li>
</ol>
<p>
The <a>user agent</a> MUST NOT capture content that's behind a
partially transparent captured <a>display surface</a>.
Expand Down

0 comments on commit 04ede15

Please sign in to comment.