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
34 changes: 33 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 preferInitialWindowPlacement = 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.

If |options|["{{DocumentPictureInPictureOptions/preferInitialWindowPlacement}}"]
exists and is true, then the user agent may use this hint to prefer behavior
that is similar that is similar to steps 12 and 13, rather than considering any
previous position or size of any previously closed |pip traversable| window.

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,32 @@ picture-in-picture experience. Use the
button.

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

## Prefer initial window placement ## {#example-prefer-initial-window-placement}

While a document picture-in-picture window is open, the user may manually
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 rather than opening it in is original,
default position.

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/preferInitialWindowPlacement}}
value 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">
await documentPictureInPicture.requestWindow({
preferInitialWindowPlacement: true
});
</pre>

# Acknowledgments # {#acknowledgments}
Expand Down
Loading