Open Bug 1599061 Opened 5 years ago Updated 2 years ago

The browser window is focused when the Picture-in-Picture is closed on macOS

Categories

(Core :: Widget: Cocoa, defect, P3)

Desktop
macOS
defect

Tracking

()

REOPENED
Tracking Status
firefox72 --- wontfix
firefox84 --- wontfix
firefox85 --- wontfix
firefox86 --- wontfix

People

(Reporter: george.craciun, Unassigned)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [fidefe-MR1-2022])

Attachments

(1 file, 1 obsolete file)

Build ID 20191124230652
User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:72.0) Gecko/20100101 Firefox/72.0

Platforms:
macOS

Steps to reproduce:

  1. Launch Firefox
  2. Go to any video, such as youtube: https://www.youtube.com/watch?v=IoinmjCmM-E and start the video
  3. Enable the PiP window
  4. Focus another application, for example Finder
  5. Close the PiP window by clicking on "X" button

Expected Result:
The PiP window is closed and the current application is still displayed.

Actual Result:
The PiP windows is closed and the Firefox browser is displayed.

Note:
The current tab is displayed when the PiP window is closed, not the tab with the video that was streamed.

Priority: -- → P3
No longer blocks: 1595504
Blocks: 1662870

Hi, just a quick update on this issue, this still occurs in our latest Nightly, Beta and Release on MacOS devices.

Blocks: 1685549
No longer blocks: 1662870

I can verify that this is till a bug in 88.0 (64-bit).

Component: Video/Audio Controls → Picture-in-Picture
Version: 72 Branch → Trunk
Whiteboard: [fidefe-MR1-2022]
Blocks: 1742457

I assumed that Bug 1756001 would resolve this issue, but it seems I'm still able to reproduce it on MacOS Big Sur, interestingly enough.

Hi there I would like to try working on this bug. Would anyone be able to guide me on how to get started?

(In reply to av from comment #4)

Hi there I would like to try working on this bug. Would anyone be able to guide me on how to get started?

Two areas worth investigating are:

I think those two areas are a good starting point. Both interact with each other via JSActors, and more information on how they communicate can be found in the PiP Firefox Source Docs. We also have docs for JSActors if you are curious.

Alright thanks. I will take a look.

Also want to add that this bug occurs on my Windows 10 device. It seems that this issue is independent of the OS.

When you tested on Windows 10, did you run a local Firefox build, or a specific release version? If a specific release version, then the fix is not shipped yet (in a couple days it will).

Flags: needinfo?(av)

It was a specific release version. I did notice the nightly build did not have that issue as well. My last post can be ignored then. Thanks.

Flags: needinfo?(av)

So after some further investigation, I was able to figure out why this bug is occurring. I am very certain that this is the cause.

The window closing behaviour we see in bug 1599061 is something built into the OS. This behaviour can be observed with the Finder application which further points to this being the case. This can be reproduced by following the steps below, similar to the issue with PIP:

  1. Open an application such as the App Store.
2. Open two finder windows

3. Layer the windows in this order: finder window #1, app store, finder window #2

4. Close finder window #2. Notice how finder window #1 is brought into focus when we would expect the App Store to come into focus

I will take a look into the tab focusing issue next.

Alright, so I have come up with a working solution to fix the current tab being displayed when PIP window is closed, and not the tab with the video that was streamed. I will submit my proposed fix for review soon.

Assignee: nobody → av
Status: NEW → ASSIGNED

We can prevent the window reordering using the -[NSView shouldDelayWindowOrderingForEvent:] API. I have a patch.

Assignee: av → mstange.moz
Component: Picture-in-Picture → Widget: Cocoa
Product: Toolkit → Core
Attachment #9270579 - Attachment is obsolete: true
Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/3edfe1be6842 Don't reorder windows when clicking the Picture-in-picture window. r=mac-reviewers,spohl
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 101 Branch
Depends on: 1756001

Should we ask the sheriffs to back this one out to fix bug 1766031?

Flags: needinfo?(mstange.moz)

Yes, let's do that. I've asked the sheriffs.

Flags: needinfo?(mstange.moz)
Status: RESOLVED → REOPENED
Flags: needinfo?(mstange.moz)
Resolution: FIXED → ---
Target Milestone: 101 Branch → ---
Blocks: 1772335
No longer blocks: 1772335
Severity: normal → S3

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:mstange, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(spohl.mozilla.bugs)
Flags: needinfo?(mstange.moz)
Flags: needinfo?(spohl.mozilla.bugs)
Flags: needinfo?(mstange.moz)
Assignee: mstange.moz → nobody
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: