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 x and y to DocumentPictureInPictureOptions #34

Open
tomayac opened this issue Apr 26, 2023 · 4 comments
Open

Add x and y to DocumentPictureInPictureOptions #34

tomayac opened this issue Apr 26, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@tomayac
Copy link
Contributor

tomayac commented Apr 26, 2023

Since DocumentPictureInPicture.requestWindow() returns a Window which exposes moveTo(), I expected it to work, but in practice it doesn't. My use case is that I have a PiP dashboard that I like to move to a particular area of the screen, which of course is different from the default position in the lower right. Should this work? I was unsure whether to file a Chromium bug or a spec Issue, similar to #33. Sorry if it's more of an implementation problem.

@steimelchrome
Copy link
Collaborator

Chrome currently disables this API on purpose and the spec mentions the website being unable to set the position of the PiP window (as a way to help prevent spoofing). It is something we're considering revisiting (along with the ability to resize the PiP window).

@steimelchrome
Copy link
Collaborator

For context though, would your use case be solved if we allowed the website to specify an initial position, even if we didn't also enable moveTo()?

@tomayac
Copy link
Contributor Author

tomayac commented Apr 27, 2023

(I searched the spec for "move", but didn't find anything. The relevant search term would have been "position".) For people following this, the relevant spec section is this:

The website cannot set the position of the PiP window.

A non-normative comment is this:

While the aspect ratio or size of the window can be configured by the website, the initial position is left to the discretion of the user agent.

My use case could be perfectly solved by allowing an x and y position to be specified as part of the DocumentPictureInPictureOptions. This way, I could store the width, height, x, and y in localStorage, and restore the position and size exactly as it was the last time. I already do this for width and height, and it works great.

@tomayac tomayac changed the title Should Window.moveTo() work on a PiP window? Add x and y to DocumentPictureInPictureOptions Apr 27, 2023
@eighty4
Copy link

eighty4 commented Jun 13, 2023

Dynamically positioning the window would be a useful feature to have. If there's interactive content in a browser, it would be nice to be able to move the PiP window relative to the mouse position over the browser. I understand concerns about spoofing, though. An alternative could be a cat paw/laser pointer mode where the PiP window transitions away on one side of the screen to transition into position on the opposite side of the screen.

This is essentially the capability I'd implement if I had x and y positioning properties. Have it be a feature/mode of the PiP window itself would lend itself to a more ergonomic/natural feeling transition vs setting the position and having it flicker to the other side of the screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants