Open Bug 2079949 Opened 1 month ago Updated 21 hours ago

With always-show PiP toggle pref == true, the url bar toggle still appears on YouTube music tracks without video content

Categories

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

defect

Tracking

()

People

(Reporter: kpatenio, Unassigned)

Details

(Keywords: good-first-bug)

Attachments

(1 file)

STR:

  1. Go to about:config and enable media.videocontrols.picture-in-picture.video-toggle.always-show
  2. Go to YouTube music and try to find a track without video content. E.g. https://music.youtube.com/watch?v=WKU8DJzipW4
  3. At the address / url bar, there should be a Picture-in-Picture toggle icon. When you see it, click it.

Expected:

Actual:

  • However, because of lazy.PIP_TOGGLE_ALWAYS_SHOW, the url bar toggle is visible with the pref enabled.
  • Pressing the toggle will show an incomplete PiP player due to lack of video content. The ideal solution is to never show the toggle in the first place.

Through my observations in Bug 2088641, I learned the video element is visibly hidden on the page, but technically still in the DOM.

We already check for visibility in https://searchfox.org/firefox-main/rev/3ed11452652b84dea6d27db877a401a146e44ba3/toolkit/actors/PictureInPictureChild.sys.mjs#2020-2022. The easiest fix might be to move the entire block before this lazy.PIP_TOGGLE_ALWAYS_SHOW block, so that a video's visibility is prioritized over the pref.

It would be nice to add a test as well to browser_urlbar_toggle.js, verifying the url bar toggle never appears for an unrendered video (e.g. display: none, height or width = 0). The existing tasks in the file assume the video is always visible and available; for our test, we could try getting a reference to that video, changing its CSS properties, and then forcing it to reload via video.load(). Then, we assert the url bar toggle is hidden (example, example2).

Existing tests in toolkit/components/pictureinpicture/tests should also pass. If a test fails while running the entire suite via ./mach test, try re-running the command for individual tests and checking if the failures persist.

Keywords: good-first-bug

i'd like to work on this. i have a local patch that moves the checkVisibility() check in videoIsPiPEligible above the always-show block, like comment 1 suggests, plus a test in browser_urlbar_toggle.js with a hidden video (it times out without the fix). i'll put it up on phabricator in a day or so.

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

Attachment

General

Creator:
Created:
Updated:
Size: