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 disallowPositionReuse #119

Merged
merged 11 commits into from
Aug 19, 2024
35 changes: 34 additions & 1 deletion spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ dictionary DocumentPictureInPictureOptions {
[EnforceRange] unsigned long long width = 0;
[EnforceRange] unsigned long long height = 0;
boolean disallowReturnToOpener = false;
boolean ignorePreviousWindowBounds = false;
};

[Exposed=Window, SecureContext]
Expand Down Expand Up @@ -219,6 +220,12 @@ problems.
window such that the distance between the top and bottom edges of the
viewport are |options|["{{DocumentPictureInPictureOptions/height}}"]
pixels.
<p class="note">
If |options|["{{DocumentPictureInPictureOptions/ignorePreviousWindowBounds}}"]
exists and is true, then the user agent may use this hint to prefer behavior
that is similar to steps 12 and 13, rather than considering any previous
position or size of any previously closed |pip traversable| window.
</p>
14. If |options|["{{DocumentPictureInPictureOptions/disallowReturnToOpener}}"] exists
and is <code>true</code>, the user agent should not display UI affordances
on the picture-in-picture window that allow the user to return to the
Expand Down Expand Up @@ -667,7 +674,33 @@ picture-in-picture experience. Use the
button.

<pre class="lang-javascript">
documentPictureInPicture.requestWindow({ disallowReturnToOpener: true });
documentPictureInPicture.requestWindow({
disallowReturnToOpener: true
}).then(...);
</pre>

## Ignore previous window bounds ## {#example-ignore-previous-window-bounds}

While a document picture-in-picture window is opened, the user may choose
to resize or reposition it. If the document picture-in-picture window is
closed, then reopened later, the user agent may use the previous position
and size as a hint for where to place the new window.

The site can provide a hint to the user agent that reusing the previous
document picture-in-picture window position and size is not desirable
by setting the {{DocumentPictureInPictureOptions/ignorePreviousWindowBounds}}
option to true. For example, if the site is requesting the new document picture-in-
picture window for an unrelated activity from the previous one, then the site
might provide this hint to the user agent. In response, the user agent may
choose to use the default position, the default size, or the size hint
provided by the site instead.

<pre class="lang-javascript">
documentPictureInPicture.requestWindow({
ignorePreviousWindowBounds: true,
width: 320,
height: 480
}).then(...);
</pre>

# Acknowledgments # {#acknowledgments}
Expand Down