Skip to content

Commit dd6f1e1

Browse files
committed
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.
1 parent 690709a commit dd6f1e1

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

index.html

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,24 @@ <h2>
423423
abort these steps.
424424
</p>
425425
</li>
426+
<li>
427+
<p>If the <a>current settings object</a>'s's [=relevant global object=]'s [=associated Document=]'s
428+
[=top-level browsing context=] is losing <a data-cite="!HTML/#gains-focus">focus</a>,
429+
queue a global task on the <a data-cite="!HTML/#user-interaction-task-source">user interaction task source</a>
430+
given <a>current settings object</a>'s [=relevant global object=] to run the following step:
431+
<ol>
432+
<li><p>Set <var>controller</var>.{{CaptureController/[[FocusChangeDisabled]]}} to <code>true</code>.</p></li>
433+
</ol>
434+
</p>
435+
<p class="note">
436+
These steps ensure {{CaptureController}} will not override explicit focus actions made by the user,
437+
typically if a user decides to switch to another surface shortly after starting capture.
438+
This algorithm describes what to do for surface pickers implemented by the <a>user agent</a> but the same
439+
requirement applies to surface pickers outside implemented outside of the <a>user agent</a>,
440+
where the loss of capturing document focus is not necessarily the signal triggering setting
441+
{{CaptureController/[[FocusChangeDisabled]]}} to<code>true</code>.
442+
</p>
443+
</li>
426444
<li>
427445
<p><em>Permission Failure</em>: [=Reject=]
428446
<var>p</var> with a new {{DOMException}}
@@ -435,23 +453,6 @@ <h2>
435453
<p>Return <var>p</var>.</p>
436454
</li>
437455
</ol>
438-
<p>
439-
When the top-level document loses focus, run the following steps on all
440-
{{CaptureController}} objects in that document and in documents of its nested
441-
[=browsing contexts=]:
442-
</p>
443-
<ol>
444-
<li>
445-
<p>
446-
If {{CaptureController/[[Source]]}} is <code>undefined</code>, abort these steps.
447-
</p>
448-
</li>
449-
<li>
450-
<p>
451-
Set {{CaptureController/[[FocusChangeDisabled]]}} to <code>true</code>.
452-
</p>
453-
</li>
454-
</ol>
455456
<p>
456457
The <a>user agent</a> MUST NOT capture content that's behind a
457458
partially transparent captured <a>display surface</a>.

0 commit comments

Comments
 (0)