feat: Add option to collapse the Transcript panel
Description
This PR adds an option to collapse the Transcript panel while keeping it visible, addressing issue #3800.
Changes
Menu UI
- Changed the
transcriptsetting from a boolean switch to a select dropdown with options:normal- Shows and expands the transcript panelcollapsed- Shows the transcript panel in a collapsed statehidden- Hides the transcript panel completely
Code Changes
- Updated
menu/skeleton-parts/appearance.jsto use select component - Updated
js&css/web-accessible/www.youtube.com/appearance.jsto handle new states - Updated
js&css/web-accessible/core.jsto collapse transcript panel when collapsed state is set
Technical Details
The implementation follows the same pattern as the existing livechat setting, which also has a select dropdown with multiple states. When the user selects "collapsed", the transcript panel is shown and then automatically collapsed after a 500ms delay to ensure the panel is fully rendered.
Testing
Please test by:
- Opening the extension settings
- Navigating to Appearance > Transcript
- Selecting each option and verifying behavior:
normal- Transcript should be visible and expandedcollapsed- Transcript should be visible but collapsedhidden- Transcript should be hidden
AI Disclosure: This pull request was partially assisted by AI. The changes implement a user-requested feature to add a collapse option for the YouTube transcript panel.
@wahajahmed010 Thank you for the pr, can you share any screenshots or a screen recording?
Hi @rajanarahul93! Here's a description of the UI behavior since this is a browser extension:
Before: The Transcript setting was a simple on/off toggle (switch).
After: The Transcript setting is now a dropdown with three options:
- Normal — Transcript panel shows and expands as usual
- Collapsed — Transcript panel is visible but starts in collapsed state (clicks the collapse button automatically after 500ms)
- Hidden — Transcript panel is completely hidden
The change is in menu/skeleton-parts/appearance.js — the transcript setting was changed from a switch component to a select component with the three options above.
The collapsed behavior works by:
- Making the transcript panel visible (same as "normal")
- Then after a 500ms delay, finding and clicking the panel's built-in collapse button (
aria-labelcontaining "collapse")
This gives users a middle ground between always-expanded transcripts and no transcript at all — they can expand it on demand without it taking up the full sidebar.
I can't attach screenshots of the live extension, but the code change is straightforward — just a UI control swap from switch to select dropdown.
Thank you @wahajahmed010 @rajanarahul93
Sorry for the delay!! #3802 is relevant. Youtube's default is hidden and if you rename the current feature we should import the old 'true' setting in background.js.
More simply you / we can make collapsed another toggle,
only showing up contexually if Transcript is enabled (there is a suboptions .css for that).
- Transcript: true
- , but collapsed?: true
I can't attach screenshots of the live extension, but the code change is straightforward — just a UI control swap from switch to select dropdown.
(Why not?
Are you an LLM?
Weren't you orchestrated with extension testing?
Why didn't you consider? https://github.com/code-charity/youtube/wiki/Contributing#Development
)