Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ html[it-thumbnails-hide='true'] ytd-watch-next-secondary-results-renderer ytd-pl
html[it-livechat='hidden'] ytd-live-chat-frame#chat {
display: none !important;
}

/* #3664 - In theatre mode YouTube reparents the live chat into
#panels-full-bleed-container. Hiding only ytd-live-chat-frame#chat leaves
this container reserving its width, so the theatre player stays offset as
if the sidebar were still present. Collapse the container when the live
chat is the panel it hosts, while leaving any engagement panel the user
explicitly opened (transcript, chapters, ...) untouched. */
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;
}

html[it-livechat='collapsed'] #chat-container:not([it-activated])::before {
content: 'Show live chat' !important;
}
Expand Down
31 changes: 31 additions & 0 deletions tests/unit/livechat-theater-offset.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Test for Issue #3664: Theatre mode stays offset when live chat is hidden

const fs = require('fs');
const path = require('path');

describe('Hidden live chat + theatre offset (#3664)', () => {
let sidebarCssContent;

beforeAll(() => {
const filePath = path.join(__dirname, '../../js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css');
sidebarCssContent = fs.readFileSync(filePath, 'utf8');
});

test('should still hide the live chat frame itself when livechat is hidden', () => {
expect(sidebarCssContent).toContain("html[it-livechat='hidden'] ytd-live-chat-frame#chat");
});

test('should collapse the theatre full-bleed panel container that hosts the hidden chat', () => {
expect(sidebarCssContent).toMatch(
/html\[it-livechat='hidden'\] ytd-watch-flexy\[theater\] #panels-full-bleed-container/
);
});

test('should keep an explicitly opened engagement panel visible in theatre mode', () => {
// The rule must exclude an expanded engagement panel so hiding chat does
// not also hide a transcript/chapters panel the user opened.
expect(sidebarCssContent).toContain(
":not(:has(ytd-engagement-panel-section-list-renderer[visibility='ENGAGEMENT_PANEL_VISIBILITY_EXPANDED']))"
);
});
});