Skip to content

fix(livechat): collapse theatre full-bleed chat container when live chat is hidden (#3664) - #4267

Open
yu2971512385-ui wants to merge 1 commit into
code-charity:masterfrom
yu2971512385-ui:fix/3664-theatre-livechat-offset
Open

fix(livechat): collapse theatre full-bleed chat container when live chat is hidden (#3664)#4267
yu2971512385-ui wants to merge 1 commit into
code-charity:masterfrom
yu2971512385-ui:fix/3664-theatre-livechat-offset

Conversation

@yu2971512385-ui

Copy link
Copy Markdown

What this fixes

Fixes #3664 — in theatre mode, when Live chat is set to Hidden, the player stays offset to the left as if the sidebar/chat were still there, leaving an empty column on the right.

Root cause

The existing rule only hides the chat frame itself:

html[it-livechat='hidden'] ytd-live-chat-frame#chat { display: none !important; }

In theatre mode YouTube reparents the live chat into #panels-full-bleed-container. Setting only #chat to display:none removes the chat contents but the surrounding #panels-full-bleed-container keeps reserving its width, so the theatre player never reclaims that space. (This matches the community uBlock workaround ###panels-full-bleed-container mentioned in the issue.)

A repo-wide search confirms #panels-full-bleed-container was not handled anywhere before this change.

The fix

Collapse #panels-full-bleed-container while it is hosting the hidden chat, scoped to theatre mode:

html[it-livechat='hidden'] ytd-watch-flexy[theater] #panels-full-bleed-container:has(ytd-live-chat-frame#chat):not(:has(ytd-engagement-panel-section-list-renderer[visibility='ENGAGEMENT_PANEL_VISIBILITY_EXPANDED'])) {
    display: none !important;
}
  • Scoped to ytd-watch-flexy[theater] so the normal (non-theatre) layout is untouched.
  • :has(ytd-live-chat-frame#chat) — only act on the container that hosts the chat.
  • :not(:has(...EXPANDED)) — if the user explicitly opens an engagement panel (transcript, chapters, …) in theatre mode, the container stays visible so those panels remain usable.

Tests

Added tests/unit/livechat-theater-offset.test.js, mirroring the existing hide-sidebar-transcript.test.js CSS-content style. npx jest passes locally.

How to reproduce / verify

  1. Set Live chatHidden
  2. Open a live stream, switch to theatre mode
  3. Before: player is offset with an empty right column. After: player fills the width.
  4. Open a transcript/chapters panel in theatre mode → still shows (not affected).

I've verified the rule loads via the manifest content-script CSS and that unit tests pass; a second visual confirmation from anyone on the issue is very welcome.

…hat is hidden (code-charity#3664)

In theatre mode YouTube reparents the live chat into
#panels-full-bleed-container. The existing rule only sets
`ytd-live-chat-frame#chat { display: none }`, so the container keeps
reserving its width and the theatre player stays offset as if the
sidebar were still present.

Collapse #panels-full-bleed-container while it is hosting the hidden
chat, scoped to theatre mode, and exclude the case where the user has
an engagement panel (transcript, chapters, ...) explicitly expanded so
those panels remain usable.

Adds tests/unit/livechat-theater-offset.test.js mirroring the existing
CSS-content unit tests.
@yu2971512385-ui
yu2971512385-ui force-pushed the fix/3664-theatre-livechat-offset branch from 7375ae4 to 3b6acaf Compare August 5, 2026 08:42
@yu2971512385-ui

Copy link
Copy Markdown
Author

Tested locally as an unpacked extension on a live stream in theatre mode:

  • Before: the player was offset with an empty column on the right.
  • After: the player fills the full width.
  • Confirmed that an opened transcript panel still shows in theatre mode.

Happy to adjust the selector scope if you'd prefer.

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.

🐞Theatre mode is offset as if the sidebar is still there, even though sidebar is blank

1 participant