Closed Bug 1997878 Opened 1 month ago Closed 11 hours ago

If a PiP window is open from a Split View, switching to another tab will close the PiP window

Categories

(Firefox :: Tabbed Browser, defect, P2)

Desktop
All
defect

Tracking

()

RESOLVED FIXED
148 Branch
Tracking Status
firefox146 --- disabled
firefox147 --- affected
firefox148 --- fixed

People

(Reporter: atrif, Assigned: kcochrane)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-splitview])

Attachments

(3 files)

Attached image split_PiP.gif

Found in

  • 146.0a1 (2025-11-02)

Affected versions

  • 146.0a1 (2025-11-02)

Tested platforms

  • Affected platforms: Ubuntu 24, Windows 11, macOS 26
  • Unaffected platforms: none

Preconditions

  • split view enabled

Steps to reproduce

  1. Create a split view with a video and open PiP.
  2. Switch to another tab.

Expected result

  • PiP window remains visible.

Actual result

  • PiP window is closed.

Regression range

  • New feature. Happens after bug 1986946 implementation.

Additional notes

  • Attached a screen recording.

Hi, just adding two additional notes:

  • This seems to only been occuring with PiP on youtube
  • Once you resize split-view it does not occur (in the same split-view)
Severity: -- → S3
Priority: -- → P2

This is pretty strange - it looks like PiP is closing because YouTube is removing the video element from the page when the tab is backgrounded. Once the splitview is resized even just a little bit though (1-2px seems to be enough), YouTube stops doing this.

Assignee: nobody → kcochrane
Status: NEW → ASSIGNED

Gonna link bug 1956165 as potentially related. It looks like Youtube doesn't allow PiP on mobile screens. Their logic for determining if it's mobile seems to be based on window width / ratios (if it's less than 2/3rds of the screen or some such). :niklas confirmed he can't reproduce this issue on an ultrawide monitor which further supports this being related to split view panels being more narrow on smaller screens/monitors.

What I still have yet to understand is:

  1. Why we're able to use PiP when the split view tab is still active
  2. Why does resizing the split view panels prevent this issue?

NIing :emilio in case he also has some ideas on this when he's back from holiday tomorrow.

Flags: needinfo?(emilio)
See Also: → 1956165

The split view tab is clearly being drawn at full window width in the background if it has not been resized yet with the splitter, switching to/away from it causes a resize event and subsequent loss of PiP window (Bug 1667458).

See Also: → 1667458

Yeah it seems the issue is that the resize happens only while the tab is in the foreground. This doesn't seem to be split view specific right? As in, I can repro the PIP window going away for:

  • Maximized window
  • Open youtube in a regular tab.
  • Use PIP.
  • Go somewhere else.
  • Shrink the window.

The code that Youtube used to have at least (probably still does) is:

g.Y.Ox = function () {
      if (this.Pw()) {
        var k = this.Zm();
        k !== 0 &&
        k !== 1 ||
        this.t5(CQ(this) ? 1 : 0);
        k = window.screen.width * window.screen.height;
        var n = window.outerHeight * window.outerWidth;
        this.W.nW ? (
          this.CL = Math.max(this.CL, k, n),
          k = n / this.CL < this.W.P6,
          this.visibility.wD(k),
          this.W.Di &&
          FZ7(this, k)
        ) : this.mediaElement &&
        KQ(this, n / k < 0.33) &&
        this.mediaElement.Lm()
      }

Where this.W was 0.3. But assuming outerHeight / outerWidth are returning the full window size (which it should) it shouldn't be to blame.

Flags: needinfo?(emilio)
Pushed by kcochrane@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5d796ce5231b https://hg.mozilla.org/integration/autoland/rev/6e84c155fe1d Preserve width of backgrounded split view panels to prevent issues with PiP when switching tabs r=desktop-theme-reviewers,tabbrowser-reviewers,jules,jsudiaman,emilio
Pushed by amarc@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/ea85f757c5cf https://hg.mozilla.org/integration/autoland/rev/f591ef6a6803 Revert "Bug 1997878 - Preserve width of backgrounded split view panels to prevent issues with PiP when switching tabs r=desktop-theme-reviewers,tabbrowser-reviewers,jules,jsudiaman,emilio" for causing marionette failures @ test_restore_split_view.py

Backed out for causing marionette failures

Flags: needinfo?(kcochrane)
Flags: needinfo?(kcochrane)
Pushed by kcochrane@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/96eccf5af235 https://hg.mozilla.org/integration/autoland/rev/c0686e07451f Preserve width of backgrounded split view panels to prevent issues with PiP when switching tabs r=desktop-theme-reviewers,tabbrowser-reviewers,jules,jsudiaman,emilio
Status: ASSIGNED → RESOLVED
Closed: 11 hours ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: