feat(UI): Add captions-style submenu for subtitle size and position - #10540
Open
aditya0155 wants to merge 1 commit into
Open
feat(UI): Add captions-style submenu for subtitle size and position#10540aditya0155 wants to merge 1 commit into
aditya0155 wants to merge 1 commit into
Conversation
avelad
reviewed
Sep 7, 2026
Comment on lines
+446
to
+456
| shaka.ui.OverflowMenu.registerElement( | ||
| 'captions-style', new shaka.ui.CaptionStyle.Factory()); | ||
|
|
||
| shaka.ui.OverflowMenu.registerElement( | ||
| 'captions-styles', new shaka.ui.CaptionStyle.Factory()); | ||
|
|
||
| shaka.ui.Controls.registerElement( | ||
| 'captions-style', new shaka.ui.CaptionStyle.Factory()); | ||
|
|
||
| shaka.ui.Controls.registerElement( | ||
| 'captions-styles', new shaka.ui.CaptionStyle.Factory()); |
Contributor
Author
There was a problem hiding this comment.
I added it to match captionsStyles config name but captions-style makes more sense so I have pushed the changes
avelad
reviewed
Sep 7, 2026
Member
There was a problem hiding this comment.
The changes in this file sound like they should be in a separate PR.
Contributor
Author
There was a problem hiding this comment.
Thanks alot for the review I have reverted the changes
avelad
reviewed
Sep 7, 2026
Member
There was a problem hiding this comment.
The changes in this file sound like they should be in a separate PR.
Contributor
Author
There was a problem hiding this comment.
Yes I have reverted the changes
Collaborator
|
Bundle Size Report for PR #10540
|
Collaborator
|
Incremental code coverage: 98.19% |
…ition Introduce shaka.ui.CaptionStyle (registered as 'captions-style') to provide a unified, nested submenu for configuring subtitle size and position. This collapses separate 'captions-size' and 'captions-position' entries into a single 'Subtitle style' item in the overflow menu, matching YouTube's player UX and eliminating overflow menu bloat. Key Changes: - ui/caption_style.js: Multi-page navigation (ROOT, SIZE, POSITION) with live subtitle preview, checkmarks, dynamic localization, and generic radio option helper. - ui/settings_menu.js: Add onBackButtonClick(event) lifecycle hook to cleanly intercept back-navigation inside nested submenus without closing the entire menu, fully backward compatible with existing subclasses. - ui/text_position.js: Extract TextPosition.getNameOfPosition(position, localization) as a public static helper to eliminate duplicate position resolution code. - ui/text_style.js: Add 'textchanged' listener to TextStyleMenu for dynamic text track availability updates. - ui/less/overflow_menu.less: Reset inline label margin in submenus to prevent misalignment. - docs/tutorials/ui-customization.md: Document 'captions-style' in controlPanelElements and overflowMenuButtons. - test/ui/ui_unit.js: Comprehensive unit tests covering navigation, preview lifecycle, overflow menu integration, track availability, and focus retention.
aditya0155
force-pushed
the
feat/caption-style-submenu
branch
from
September 7, 2026 16:28
2ad54d4 to
83060a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Related Issue
Discussion in (FreeTubeApp/FreeTube#9120 (comment))
where adding separate
captions-sizeandcaptions-positionbuttons made the overflow menu too full when subtitles were enabled.Description
This PR adds a Subtitle style (
captions-style) submenu to Shaka Player.Right now, subtitle size and subtitle position are two separate buttons. When I was adding them to FreeTube in FreeTube#9723, the menu got too full once subtitles were turned on. Making a single submenu for them like YouTube does is a much cleaner option.
What this PR does:
100% · Default).Testing
100% · Default).Before:
Before.mp4
After:
After.mp4
Tests:
test/ui/ui_unit.js.Desktop
Additional Context
Grouping size and position into one submenu keeps the player menu clean, matches YouTube's player UX, and leaves room for more subtitle settings in the future without cluttering the menu.
also apologies I linked the wrong PR link in related issue previously, I have corrected it now