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

Considering 3rd party libraries implementation on modifying window.focus API #118

Open
tmpmachine opened this issue Mar 21, 2024 · 0 comments

Comments

@tmpmachine
Copy link

tmpmachine commented Mar 21, 2024

Wouldn't it be better if document PiP has it's own implementation of refocusing on main window instead of modifying window.focus() directly?

I believe some 3rd party libraries out there use window.focus on at least one of their components that hooks on common event listeners such as mouse click or keydown. Modifying window.focus would cause unwanted behaviour on these 3rd party libraries when used in PiP window, i.e. bringing the main window to focus unintendedly when they just want to use it to take notes on some videos online.

It can often be useful for the picture-in-picture window to be able to re-focus
its opener tab, e.g. when the smaller form-factor of the window doesn't fit the
experience the user needs. We modify the {{Window/focus()}} API to allow it to
take system-level focus when a picture-in-picture window is focusing its
opener.

It can often be useful for the picture-in-picture window to be able to re-focus

On the implementation side, I've issued a crbug and added a code snippet in the comment to handle this specific use case: https://issues.chromium.org/issues/330589220.

@tmpmachine tmpmachine changed the title Considering 3rd party libraries implementation for opener window re-focus. Considering 3rd party libraries implementation on modifying window.focus API Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant