Skip to content

fix: position the video Picture-in-Picture mute button - #56089

Open
twilco wants to merge 2 commits into
electron:mainfrom
twilco:fix/pip-mute-button-position
Open

twilco wants to merge 2 commits into
electron:mainfrom
twilco:fix/pip-mute-button-position

Conversation

@twilco

@twilco twilco commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Description of Change

Since Electron 42, the mute button in the video Picture-in-Picture window (HTMLVideoElement.requestPictureInPicture()) is drawn at the top-left corner, on top of the favicon and the source title. Like in Chrome, it should be on the bottom row next to the timestamp, at the bottom-right in left-to-right layouts and at the bottom-left in right-to-left layouts.

Cause

Chromium 148 (CL 7682308) added a mute button to the video PiP window and positioned it relative to the live caption button. picture-in-picture.patch compiles the live caption code in VideoOverlayWindowViews::OnUpdateControlsBounds() out with #if 0, and the mute button's SetPosition() call sits inside that same block. The button is still created, since media::kPictureInPictureMuteControl is enabled by default, but it never gets a position and stays at (0,0).

Fix

The #if 0 block now closes before the live caption code, and the mute button is placed in the slot the live caption button would have used, at the trailing edge of the bottom controls. The rest of the live status and live caption code stays compiled out. Views mirrors the layout automatically, so the right-to-left placement needs no extra handling.

The only change to fix_move_autopipsettingshelper_behind_branding_buildflag.patch is new index hashes and line numbers, because it edits the same file after picture-in-picture.patch.

Test

A new spec, places the mute button at the trailing edge of the bottom controls, opens a video PiP window and reads the window's layout through a new testing-only binding, getVideoPictureInPictureLayoutForTesting(). It checks that the mute button is on the bottom row at the trailing edge and below the source title. The binding returns logical (unmirrored) bounds, so the check holds in right-to-left locales too. Without the fix the spec fails (expected 0 to be greater than 247: the button is at x = 0). With the fix it passes, as does the existing PiP spec.

Manual verification

Unfixed main (top row) and main plus this fix (bottom row), each in an LTR (en-US) and an RTL (he) locale:

pip-mute-button-position-fix.mp4

Checklist

This PR fixes #56006.

Assisted-By: Claude Opus 5.5, Claude Code

Release Notes

Notes: Fixed the video Picture-in-Picture mute button being drawn over the window title.

Chromium 148 (CL 7682308), shipped in Electron 42, added a mute button
to the video Picture-in-Picture window and positioned it relative to
the live caption button. picture-in-picture.patch compiles the live
caption code out with #if 0, and the mute button's SetPosition() call
sits inside that same block. The button was still created, since
media::kPictureInPictureMuteControl is enabled by default, but it was
never positioned. It stayed at (0,0), on top of the favicon and source
title.

Close the #if 0 block before the live caption code and position the
mute button in the slot the live caption button would have used, at
the trailing edge of the bottom controls. Views mirrors it to the
bottom-left in right-to-left locales.

Add a testing-only getVideoPictureInPictureLayoutForTesting() binding
that returns the logical bounds of the window's controls, and a spec
that checks the mute button is on the bottom row at the trailing edge,
below the source title. The spec fails without the fix (the button is
at x = 0) and passes with it.

Fixes electron#56006

Assisted-By: Claude Opus 5.5, Claude Code
@twilco
twilco requested a review from a team as a code owner November 28, 2026 19:48
@twilco
twilco marked this pull request as draft November 28, 2026 19:48
@twilco
twilco marked this pull request as ready for review November 28, 2026 19:55
@twilco

twilco commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Sorry @dsanders11, just noticed that you had assigned #56006 to yourself. Happy to close this PR if you'd prefer to fix this yourself!

Assisted-By: Claude Opus 5.5, Claude Code

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

[Bug]: Video Picture-in-Picture mute button drawn at the top-left corner (its position is compiled out by picture-in-picture.patch)

1 participant