Fix #4003: cinema mode / auto cinema mode shows blank screen#4106
Draft
andrianbalanesq wants to merge 2 commits into
Draft
Fix #4003: cinema mode / auto cinema mode shows blank screen#4106andrianbalanesq wants to merge 2 commits into
andrianbalanesq wants to merge 2 commits into
Conversation
When 'Auto cinema mode' is enabled and a user clicks a YouTube video,
the player area renders as a blank black rectangle and the video
doesn't load. Two defects in createOverlay() and playerCinemaModeEnable()
combine to produce this:
1. The overlay was created with rgba(0,0,0,1) — fully opaque. In
Firefox (and any browser where YouTube applies transform/will-change
to #full-bleed-container or an ancestor), the position:fixed overlay
becomes containing-block-relative and ends up sitting above the
player, swallowing the video behind a solid black rectangle.
2. The overlay had pointer-events: auto (the default), so even when the
z-index resolution was correct it could intercept clicks meant for
the play button — explaining the 'videos not loading' symptom.
This change:
- Switches the overlay to a translucent dim (rgba(0,0,0,0.7)) so the
video shows through even if the overlay lands above the player.
- Adds pointer-events: none so the overlay never blocks clicks.
- Moves the overlay from #full-bleed-container to document.body so its
position:fixed stays rooted in the viewport regardless of YouTube's
ancestor transforms.
- Reorders playerCinemaModeEnable() to bring the player to z-index
10000 BEFORE creating the overlay, so there's never a paint frame
where the overlay sits on top of an unstyled player.
Adds tests/unit/cinema-mode-bug.test.js to lock the fix in place.
Collaborator
|
the player was meant to have a higher z-Index than the curtain covering the rest of the page |
Revert overlay to opaque rgba(0,0,0,1) per maintainer feedback. The curtain is meant to cover the page; the player simply needs a higher z-index (10000 > 9999). Removed pointer-events:none and document.body append — the fix is just setting player z-index before overlay creation.
Author
|
Thanks for the direction! You are right — the curtain should stay opaque and cover the page, the player just needs to sit above it. Simplified the fix:
Pushed to the same branch. Let me know if anything else needs adjusting! ✨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4003
Problem
When
Auto cinema modeis enabled and a user clicks a YouTube video, theplayer area renders as a blank black rectangle and the video does not load.
Root cause
Two defects in
createOverlay()andplayerCinemaModeEnable()combineto produce this:
rgba(0, 0, 0, 1)— fully opaque. InFirefox (and any browser where YouTube applies
transform/will-changeto#full-bleed-containeror an ancestor), theposition: fixedoverlay becomes containing-block-relative and endsup sitting above the player, swallowing the video behind a solid black
rectangle.
pointer-events: auto(the default), so even whenthe z-index resolution was correct it could intercept clicks meant
for the play button — explaining the "videos not loading" symptom.
Fix
rgba(0, 0, 0, 0.7)) so thevideo shows through even if the overlay lands above the player.
pointer-events: noneso the overlay never blocks clicks.#full-bleed-containertodocument.bodysoits
position: fixedstays rooted in the viewport regardless ofYouTube's ancestor transforms.
playerCinemaModeEnable()to bring the player to z-index10000BEFORE creating the overlay, so there is never a paint framewhere the overlay sits on top of an unstyled player.
Tests
tests/unit/cinema-mode-bug.test.js(7 tests) — locks in the fourproperties above plus the enable/disable symmetry.