Skip to content

Fix #4003: cinema mode / auto cinema mode shows blank screen#4106

Draft
andrianbalanesq wants to merge 2 commits into
code-charity:masterfrom
andrianbalanesq:fix/issue-4003-cinema-mode
Draft

Fix #4003: cinema mode / auto cinema mode shows blank screen#4106
andrianbalanesq wants to merge 2 commits into
code-charity:masterfrom
andrianbalanesq:fix/issue-4003-cinema-mode

Conversation

@andrianbalanesq

Copy link
Copy Markdown

Closes #4003

Problem

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 does not load.

Root cause

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.

Fix

  • Switch 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.
  • Add pointer-events: none so the overlay never blocks clicks.
  • Move the overlay from #full-bleed-container to document.body so
    its position: fixed stays rooted in the viewport regardless of
    YouTube's ancestor transforms.
  • Reorder playerCinemaModeEnable() to bring the player to z-index
    10000 BEFORE creating the overlay, so there is never a paint frame
    where the overlay sits on top of an unstyled player.

Tests

tests/unit/cinema-mode-bug.test.js (7 tests) — locks in the four
properties above plus the enable/disable symmetry.

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.
@ImprovedTube2 ImprovedTube2 marked this pull request as draft July 3, 2026 21:18
@ImprovedTube2

Copy link
Copy Markdown
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.
@andrianbalanesq

Copy link
Copy Markdown
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:

  • Reverted the overlay back to opaque rgba(0, 0, 0, 1) — it is a curtain, not a dim
  • Removed pointer-events: none and the document.body append — those were overcomplicating it
  • The actual fix: set the player z-index (10000) before creating the overlay (9999), so the player is always on top from the first paint frame

Pushed to the same branch. Let me know if anything else needs adjusting! ✨

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.

Cinema mode / auto cinema mode bugged

3 participants