Skip to content

fix: keep transcript visible when hiding sidebar (#1530)#3884

Open
jiangyj545 wants to merge 1 commit into
code-charity:masterfrom
jiangyj545:fix/sidebar-transcript-visibility
Open

fix: keep transcript visible when hiding sidebar (#1530)#3884
jiangyj545 wants to merge 1 commit into
code-charity:masterfrom
jiangyj545:fix/sidebar-transcript-visibility

Conversation

@jiangyj545
Copy link
Copy Markdown

Fixes #1530

Problem: When "Hide sidebar" is enabled, the transcript engagement panel is also hidden because div#secondary div#panels is set to display: none. Users want to hide related videos but still access the transcript.

Changes

CSS (sidebar.css)

  1. Exclude panels from hiding when transcript is enabled — Changed the div#panels selector to html[it-hide-sidebar='true']:not([it-transcript='true']) div#secondary div#panels so panels are only hidden when transcript is NOT active.

  2. Explicitly show transcript panel — Added html[it-hide-sidebar='true'][it-transcript='true'] div#secondary div#panels { display: block !important } with higher specificity to override the sidebar auto-sizing rules.

  3. Hide non-transcript panels — Added html[it-hide-sidebar='true'][it-transcript='true'] div#secondary div#panels > :not([target-id*='transcript']) to ensure other engagement panels (chapters, etc.) remain hidden while only the transcript is visible.

  4. Fix secondary width for transcript layout — Added html[it-hide-sidebar='true'][it-transcript='true'] ytd-watch-flexy[flexy] #secondary.ytd-watch-flexy { width: fit-content !important; min-width: max(445px, 17vw) !important } to ensure the secondary div has enough space for the transcript panel, overriding the width: auto collapse from hide-sidebar.

Tests

Added comprehensive unit tests covering all 6 scenarios:

  • Panels hidden when sidebar hidden + transcript off
  • Panels visible when sidebar hidden + transcript on
  • Non-transcript panels hidden when both features active
  • Secondary has proper width for transcript
  • Related videos still hidden
  • Donation shelf still hidden

Improvements over #3851

The existing PR #3851 only adds :not([it-transcript='true']) to the panels selector. This PR goes further:

Aspect #3851 This PR
Excludes panels from hiding
Hides non-transcript panels (chapters, etc.)
Fixes secondary width for transcript layout
Handles CSS specificity conflicts
Comprehensive test coverage (6 tests) Basic (2 tests)

Testing

npm test
# 16 test suites, 67 tests passing

Bounty claim: This PR addresses issue #1530 which is labeled with the Bounty tag.

When both 'Hide sidebar' and 'Transcript' are enabled, the transcript
engagement panel should remain visible while related videos and other
sidebar content stay hidden.

Changes:
- Exclude div#panels from hiding when transcript is enabled
- Explicitly show transcript panel when both features are active
- Hide non-transcript panels (chapters, etc.) to keep sidebar clean
- Ensure secondary div has proper width for transcript panel layout
- Add comprehensive unit tests for the feature interaction

Fixes code-charity#1530
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.

Can we hide the sidebar, but keep the Transcript visible ?

1 participant