Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Policy: focus-without-user-activation #10672

Merged
merged 18 commits into from
Mar 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -4876,6 +4876,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
data-x="">cross-origin-isolated</code></dfn>", which has a <span
data-x="concept-default-allowlist">default allowlist</span> of <code
data-x="">'self'</code>.</li>
<li>"<dfn data-x="focus-without-user-activation-feature"><code
data-x="">focus-without-user-activation</code></dfn>", which has a <span
data-x="concept-default-allowlist">default allowlist</span> of <code
data-x="">'self'</code>.</li>
</ul>


Expand Down Expand Up @@ -61520,6 +61524,9 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
are as follows:</p>

<ol>
<li><p>If the <span>allow focus steps</span> given <var>subject</var>'s <span>node
document</span> return false, then return.</p></li>

<li><p>Let <var>control</var> be null.</p></li>

<li><p>If <var>subject</var> has the <code data-x="attr-fe-autofocus">autofocus</code>
Expand Down Expand Up @@ -80532,6 +80539,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {

<li><p>If <var>current</var> is null, then return.</p></li>

<li><p>If the <span>allow focus steps</span> given <var>current</var>'s <span
data-x="nav-document">active document</span> return false, then return.</p></li>

<li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>

<li><p>If <var>current</var> is a <span>top-level traversable</span>, user agents are encouraged
Expand All @@ -80551,6 +80561,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
method on elements, when invoked, must run the following steps:</p>

<ol>
<li><p>If the <span>allow focus steps</span> given the element's <span>node document</span>
return false, then return.</p></li>

<li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>

<li><p>Mark the element as <dfn>locked for focus</dfn>.</p></li>
Expand Down Expand Up @@ -80580,6 +80593,31 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
keyboard users. Ignoring calls to this method would thus allow keyboard users to interact with the
page.</p>

<p>The <dfn export>allow focus steps</dfn>, given a <code>Document</code> object <var>target</var>,
are as follows:</p>

<ol>
<li><p>If <var>target</var> is <span>allowed to use</span> the "<code
data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
then return true.</p></li>

<li>
<p>If any of the following are true:</p>

<ul>
<li><p><var>target</var>'s <span>relevant global object</span> has <span data-x="transient
activation">transient user activation</span>; or</p></li>

<li><p><var>target</var>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>,
if any, is marked as <i data-x="locked for focus">locked for focus</i>,</p></li>
</ul>

<p>then return true.</p>
</li>

<li><p>Return false.</p></li>
</ol>

</div>


Expand Down Expand Up @@ -80657,6 +80695,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
<li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the
<span>sandboxed automatic features browsing context flag</span>, then return.</p></li>

<li><p>If the <span>allow focus steps</span> given <var>target</var> return false, then
return.</p></li>

<li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
<var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span
data-x="nav-document">active document</span>'s <span
Expand Down Expand Up @@ -85718,6 +85759,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
element</span> <var>subject</var>:</p>

<ol>
<li><p>If the <span>allow focus steps</span> given <var>subject</var>'s <span>node
document</span> return false, then return.</p></li>

<li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
steps</span> given <var>subject</var> and return.</p></li>

Expand Down Expand Up @@ -144394,6 +144438,7 @@ INSERT INTERFACES HERE
Edward Welbourne,
Edward Z. Yang,
Ehsan Akhgari,
Ehsan Karamad,
Eira Monstad,
Eitan Adler,
Eli Friedman,
Expand Down Expand Up @@ -145032,6 +145077,7 @@ INSERT INTERFACES HERE
Yu Han, <!-- yuzhe-han on GitHub -->
Simon Spiegel,
Simon Wülker, <!-- Wuelle on GitHub -->
Siye Liu,
skeww, <!-- on reddit -->
Smylers,
Srirama Chandra Sekhar Mogali,
Expand Down