Skip to content

Commit

Permalink
Only require user gesture and not incumbent realm
Browse files Browse the repository at this point in the history
  • Loading branch information
steimelchrome committed Jan 30, 2024
1 parent 99a92c1 commit 3921511
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ Add a new step to {{Window/focus()}} after step 3, "Run the <a>focusing steps</a
1. Let |pipWindow| be |current|'s <a>active window</a>'s
<a>documentPictureInPicture API</a>'s <a>last-opened window</a>.
2. If |pipWindow| is not <code>null</code> and |pipWindow|'s <a>relevant global object</a>
is the <a>incumbent global object</a>, and |pipWindow|'s <a>relevant global object</a>
has <a>transient activation</a>, then:
1. <a>Consume user activation</a> given |pipWindow|'s <a>relevant global object</a>.
2. Give |current| <a>system focus</a>.
Expand Down Expand Up @@ -601,19 +600,12 @@ The {{Window/focus()}} API can be used to focus the opener tab from a
picture-in-picture window (requiring a user gesture):

<pre class="lang-javascript">
const addReturnToTabButtonScript = pipWindow.document.createElement('script');
addReturnToTabButtonScript.src = 'addReturnToTabButton.js';
pipWindow.document.body.append(addReturnToTabButtonScript);
</pre>

addReturnToTabButton.js:
<pre class="lang-javascript">
const returnToTabButton = document.createElement('button');
const returnToTabButton = pipWindow.document.createElement('button');
returnToTabButton.textContent = 'Return to opener tab';
returnToTabButton.addEventListener('click', () => {
opener.focus();
window.focus();
});
document.body.append(returnToTabButton);
pipWindow.document.body.append(returnToTabButton);
</pre>

# Acknowledgments # {#acknowledgments}
Expand Down

0 comments on commit 3921511

Please sign in to comment.