Closed Bug 1756001 Opened 10 months ago Closed 8 months ago

PiP close button acts as unPiP button when Firefox is out of focus

Categories

(Toolkit :: Picture-in-Picture, defect, P2)

defect

Tracking

()

VERIFIED FIXED
99 Branch
Tracking Status
firefox97 --- wontfix
firefox98 --- wontfix
firefox99 --- verified
firefox100 --- verified

People

(Reporter: asafko, Assigned: kpatenio)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-MR1-2022])

Attachments

(1 file)

Close and UnPiP buttons are supposed to work in different ways that account for specific use cases each of them has (get rid of the video vs return to it). Currently, we have a problem with Scenario #3 on this list:

Scenario 1 (close button + Firefox is in focus)

  1. Launch PiP window
  2. Navigate away from the origin video tab, but stay in Firefox.
  3. Click on the close button in the PiP window.
    Expected result: PiP window closes, video in the origin tab is paused. The origin video tab is not put in focus.

Actual result: as expected

Scenario 2 (close button + Firefox is out of focus)

  1. Launch PiP window
  2. Navigate away from the origin video tab and put another application into the focus.
  3. Click on the close button in the PiP window.
    Expected result: PiP window closes, video in the origin tab is paused. Firefox does not return in focus.

Actual result: Firefox returns in focus and opens the origin video tab. At least one user reports the video doesn’t pause.

Scenario 3 (unpip button + Firefox is in focus)

  1. Launch PiP window
  2. Navigate away from the origin video tab, but stay in Firefox.
  3. Click on the unpip button in the PiP window.
  4. PiP window closes, Firefox returns in focus and opens the origin video tab, the origin video is not paused.

Actual result: as expected

Scenario 4 (unpip button + firefox is out of focus)

  1. Launch PiP window
  2. Navigate away from the origin video tab and put another application into the focus.
  3. Click on the unpip button in the PiP window.
  4. PiP window closes, Firefox returns in focus and opens the origin video tab, the origin video is not paused.

Actual result: as expected

The problem with Scenario 3 might have been introduced as a part of this patch:
https://bugzilla.mozilla.org/show_bug.cgi?id=1687808 (possibly due to the ambiguity of what "de-activate PiP" means).

Severity: S2 → S3
Assignee: nobody → kpatenio
Status: NEW → ASSIGNED
Component: Video/Audio Controls → Picture-in-Picture

It appears that even if we press the close button, we still end up refocusing onto firefox. This is caused by the method _focusPipBrowserWindow, which is called in the method closeSinglePipWindow that is ultimately responsible for closing the pip window (regardless if unpipping or actually pressing the x icon). Scenario 1 looks like it works as expected because we are already focused on the browser by the time _focusPipBrowserWindow is called.

I think all we need to do is remove _focusPipBrowserWindow to prevent refocusing when pressing the close button. This does not affect unpipping since there is already another method focusTabAndClosePip responsible for focusing us back onto the original video's page.

Pushed by kpatenio@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b71ba7fd2edd
fix pip close button acting like unpip button r=pip-reviewers,mhowell
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
Flags: qe-verify+
Flags: qe-verify+

I've managed to reproduce this issue only on Mac OS and Ubuntu 20 (Would not reproduce in Ubuntu 22 with Wayland by default or in Windows 10).
This issue no longer reproduces in last Nightly v100.0a1 from 2022-03-15 or Beta v99.0b4.

Status: RESOLVED → VERIFIED
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 9 months ago8 months ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.