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

Add option to hide the "Back to Tab" button #114

Merged
merged 4 commits into from
Mar 13, 2024
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
37 changes: 33 additions & 4 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ interface DocumentPictureInPicture : EventTarget {
dictionary DocumentPictureInPictureOptions {
[EnforceRange] unsigned long long width = 0;
[EnforceRange] unsigned long long height = 0;
boolean allowReturnToOpener = true;
};

[Exposed=Window, SecureContext]
Expand Down Expand Up @@ -218,16 +219,32 @@ problems.
window such that the distance between the top and bottom edges of the
viewport are |options|["{{DocumentPictureInPictureOptions/height}}"]
pixels.
14. Configure |pip traversable|'s <a>active browsing context</a>'s window to
14. If |options|["{{DocumentPictureInPictureOptions/allowReturnToOpener}}"] exists
and is <code>false</code>, the user agent should not display UI affordances
on the picture-in-picture window that allow the user to return to the
opener window.

<p class="note">
For both video and document picture-in-picture, user agents often display a
button for the user to return to the original page and close the
picture-in-picture window. While this action makes sense in most cases
(especially for a video picture-in-picture window that returns the video to the
main document), it does not always make sense for document picture-in-picture
windows. {{DocumentPictureInPictureOptions/allowReturnToOpener}} is a hint to the
user agent from the website as to whether that action makes sense for their
particular document picture-in-picture experience.
</p>

15. Configure |pip traversable|'s <a>active browsing context</a>'s window to
float on top of other windows.
15. Set <a>this</a>'s <a>last-opened window</a> to |pip traversable|'s <a>active window</a>.
16. <a>Queue a global task</a> on the
16. Set <a>this</a>'s <a>last-opened window</a> to |pip traversable|'s <a>active window</a>.
17. <a>Queue a global task</a> on the
<a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/webappapis.html#dom-manipulation-task-source">DOM manipulation task source</a>
given <a>this</a>'s <a>relevant global object</a> to <a>fire an event</a>
named {{enter}} using {{DocumentPictureInPictureEvent}} on
<a>this</a> with its {{DocumentPictureInPictureEvent/window}} attribute
initialized to |pip traversable|'s <a>active window</a>.
17. Return |pip traversable|'s <a>active window</a>.
18. Return |pip traversable|'s <a>active window</a>.

</div>

Expand Down Expand Up @@ -640,6 +657,18 @@ content in question inside the PiP window:
}
</pre>

## Hide return-to-opener button ## {#example-hide-return-to-opener}

While user agents often display a button on their video and document
picture-in-picture windows to return to the opener and close the window,
this button doesn't always make sense for some websites' document
picture-in-picture experience. Use the
{{DocumentPictureInPictureOptions/allowReturnToOpener}} option to hide the button.

<pre class="lang-javascript">
documentPictureInPicture.requestWindow({ allowReturnToOpener: false });
</pre>

# Acknowledgments # {#acknowledgments}

Many thanks to Frank Liberato, Mark Foltz, Klaus Weidner, François Beaufort,
Expand Down
Loading